Skip to content

Instantly share code, notes, and snippets.

@ppmotskula
Created January 25, 2012 04:06
Show Gist options
  • Save ppmotskula/1674646 to your computer and use it in GitHub Desktop.
Save ppmotskula/1674646 to your computer and use it in GitHub Desktop.
chroot setup script to allow running 32-bit vmware-view-client in 64-bit Oneiric
#!/bin/bash
echo "
Tech Preview of the VMware View Client with PCoIP for Linux --
chroot installer for 64-bit Ubuntu Oneiric
Copyright (c) 2012 Peeter P. Mõtsküla <peeterpaul@motskula.net>
"
# set global variables
vCONF=/etc/schroot/chroot.d/view64.conf
vROOT=/srv/chroot/view64
vICON=/usr/share/pixmaps/vmware-view-client-vmware.png
vDTOP=/usr/share/applications/vmware-view-client.desktop
# installer function
vInstall () {
echo "Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the \"Software\"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"
read -p "Press Enter to accept or ^C to abort." && echo
echo "This script will set up a 32-bit chroot environment for running the new
PCoIP-enabled VMware View Client on 64-bit Oneiric.
During setup, sudo will ask your password, possibly more than once.
For technical details, open \"$0\" in your favourite text editor.
After successful installation, VMware View Client can be started from the
Unity launcher.
To uninstall, run \"$0 remove\"."
read -p "Press Enter to continue or ^C to abort." && echo
# try to install debootstrap and schroot if needed
sudo apt-get -qq install debootstrap || {
echo "Failed to install debootstrap, aborting."
exit
}
sudo apt-get -qq install schroot || {
echo "Failed to install schroot, aborting."
exit
}
# test for existing chroot, try to remove if found
vTEST=0
[ -e $vCONF ] && {
echo "chroot configuration '$vCONF' exists."
vTEST=1
}
[ -e $vROOT ] && {
echo "chroot directory '$vROOT' exists."
vTEST=1
}
[ $vTEST == 1 ] && {
read -p "Press Enter to overwrite or ^C to abort."
sudo rm -rf $vCONF $vROOT
}
# create chroot
{
sudo bash -c "echo \"[view64]
description=32-bit Oneiric for running VMware View under 64-bit Oneiric
directory=/srv/chroot/view64
personality=linux32
type=directory
root-users=$USER
users=$USER\" > $vCONF" &&
sudo mkdir -p $vROOT &&
sudo debootstrap --variant=buildd --arch=i386 oneiric $vROOT http://archive.ubuntu.com/ubuntu/
} || {
echo "Failed to create chroot, aborting."
exit
}
# install vmware-view-client into chroot
{
sudo bash -c "echo \"deb http://archive.ubuntu.com/ubuntu oneiric universe
deb http://archive.canonical.com/ubuntu oneiric partner\" >> $vROOT/etc/apt/sources.list" &&
schroot -c view64 -u root -- bash -c "apt-get update && apt-get -y install vmware-view-client"
} || {
echo "Failed to install vmware-view-client, aborting."
exit
}
# install application launcher
{
sudo cp $vROOT$vICON /usr/share/pixmaps/ &&
sudo bash -c "echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
Icon=vmware-view-client-vmware
Exec=schroot -c view64 -- bash -c \"DISPLAY=:0.0 vmware-view\"
Categories=Application;Network;
Name=VMware View Client' > $vDTOP"
} || {
echo "Failed to install application launcher."
exit
}
echo "
Done. You can start the new VMware View Client from Unity launcher.
"
read -p "Press Enter to start VMware View Client now or ^C to return to shell." &&
schroot -c view64 -- bash -c "DISPLAY=:0.0 vmware-view"
}
# remover function
vRemove () {
read -p "Press Enter to remove chrooted VMware View Client or ^C to cancel."
sudo rm -rf $vCONF $vROOT $vICON $vDTOP
if [ -e $vCONF ] || [ -e $vROOT ] || [ -e $vICON ] || [ -e $vDTOP ] ; then
echo "Failed to remove:"
test -e $vCONF && echo " $vCONF"
test -e $vROOT && echo " $vROOT"
test -e $vICON && echo " $vICON"
test -e $vDTOP && echo " $vDTOP"
else
echo "All files removed."
fi
echo "Run \"sudo apt-get remove debootstrap schroot\" if you want to remove them."
}
# main block
if [ "$1" == "" ] ; then
vInstall
elif [ "$1" == "remove" ] ; then
vRemove
else
echo "Use
\"$0\" to install or
\"$0 remove\" to remove"
fi
@selfisch
Copy link

Hi,

bin hier auf der Arbeit leider hinter einem Proxy und hatte auch in der Vergangenheit schon das Problem, dass ich aus einer chroot heraus kein apt nutzen konnte, da er sich die Release nicht ziehen kann:

I: Retrieving Release
E: Failed getting release file http://archive.ubuntu.com/ubuntu/dists/oneiric/Release
Failed to create chroot, aborting.

Hast du hier zufällig eine Idee?

Grüße
Timo

P.S.
sorry, das "/dists" musst du übersehen. Hatte ich nur testweise eingefügt.

@selfisch
Copy link

Ich habs gefunden. Unglaublich, nen ganzen Tag mit suchen verbracht, aber irgendwo war dann der richtige Codeschnippsel dabei.

Für alle die es interessiert, so muss folgende Zeile 89 aussehen:

sudo http_proxy="http://<your.proxy.address>:/" debootstrap --variant=buildd...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment