Code Sample |
#!/bin/sh # # .start_synaptic - Checks to see if the Synaptic package manager GUI is # already installed and starts it up. Otherwise, it # installs the program. # Rev 0 12/26/03 # Has this script called itself with the install argument? while [ "$1" = "install" ] do # If the user is running DSL from the KNOPPIX compressed file system, a # writable version of the read-only system directories must be created. # Otherwise, it will be impossible to install programs that add new files # into these directories and subdirectories. ls -l /usr | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'System is running from a Live CD compressed image filesystem. ' echo 'Creating a writable /usr tree on the RAM Disk...' cp -srd /KNOPPIX/usr/ /ramdisk ln -sf --target-directory=/ /ramdisk/usr fi rm /tmp/startsynaptic.tmp ls -l /bin | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable /bin tree on the RAM Disk...' cp -srd /KNOPPIX/bin/ /ramdisk ln -sf --target-directory=/ /ramdisk/bin fi rm /tmp/startsynaptic.tmp ls -l /boot | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable /boot tree on the RAM Disk...' cp -srd /KNOPPIX/boot/ /ramdisk ln -sf --target-directory=/ /ramdisk/boot fi rm /tmp/startsynaptic.tmp ls -l /lib | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable /lib tree on the RAM Disk...' cp -srd /KNOPPIX/lib/ /ramdisk ln -sf --target-directory=/ /ramdisk/lib fi rm /tmp/startsynaptic.tmp ls -l /sbin | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable /sbin tree on the RAM Disk...' cp -srd /KNOPPIX/sbin/ /ramdisk ln -sf --target-directory=/ /ramdisk/sbin fi rm /tmp/startsynaptic.tmp # Next, we need to make sure that the apt related directories are # writable. If the user is running from the KNOPPIX compressed # filesystem, new directories will be created and a non read-only # version of the lock file will be copied into the new location. ls -l /var/cache/apt | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable apt cache directory on the RAM Disk...' rm -rf /ramdisk/var/cache/apt cp -srd /KNOPPIX/var/cache/apt/ /ramdisk/var/cache echo 'Creating a writable apt lock file...' rm -rf /ramdisk/var/cache/apt/archives/lock cp /KNOPPIX/var/cache/apt/archives/lock /ramdisk/var/cache/apt/archives fi rm /tmp/startsynaptic.tmp ls -l /var/lib/apt | grep 'KNOPPIX' > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then echo 'Creating a writable apt lib directory on the RAM Disk...' rm -rf /ramdisk/var/lib/apt cp -srd /KNOPPIX/var/lib/apt/ /ramdisk/var/lib fi rm /tmp/startsynaptic.tmp # If the dpkg-restore script hasn't already been restored, restore it. if [ -e /var/lib/dpkg/status ] then echo 'dpkg has already been restored. Continuing on...' else echo 'Calling the dpkg restore script...' dpkg-restore fi # Install synaptic, the Debian package management GUI echo 'Downloading and installing Synaptic...' echo $'yes\n' | apt-get install synaptic # Downlaod a synaptic icon file and create a link for the desktop icon wget -c http://savannah.nongnu.org/cgi-bin/viewcvs/*checkout*/synaptic/synaptic/pixmaps/synaptic_48x48.png mv synaptic_48x48.png /home/damnsmall/.xtdesktop/synaptic.png echo 'table Icon' > /home/damnsmall/.xtdesktop/synaptic.lnk echo ' Type: Program' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo ' Caption: Synaptic' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo ' Command: sh /home/damnsmall/.start_synaptic' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo ' Icon: /home/damnsmall/.xtdesktop/synaptic.png' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo ' X: 385' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo ' Y: 15' >> /home/damnsmall/.xtdesktop/synaptic.lnk echo 'end' >> /home/damnsmall/.xtdesktop/synaptic.lnk chown damnsmall:staff /home/damnsmall/.xtdesktop/synaptic.lnk chown damnsmall:staff /home/damnsmall/.xtdesktop/synaptic.png exit done #Check to see if synaptic is already installed. If so, start it. if test -f '/usr/sbin/synaptic' then rxvt -rv -T "Synaptic Message Terminal" -e sudo -u root /usr/sbin/synaptic & exit fi # Otherwise, run this script again in an rxvt window with the # install argument added cd /home/damnsmall rxvt -rv -T "installing Synaptic..." -e sudo -u root sh ./.start_synaptic install # Restart the xtdesktop icons if needed ps -ef | grep xtdesk | grep -v grep | grep -v re_xtdesk > /tmp/startsynaptic.tmp if test -s '/tmp/startsynaptic.tmp' then killall -9 xtdesk >/dev/null xtdesk >/dev/null & fi rm -rf /tmp/startsynaptic.tmp # Start synaptic for the first time rxvt -rv -T "Synaptic Message Terminal" -e sudo -u root /usr/sbin/synaptic & exit |