| cbagger01  
 
 
 
 
 Group: Members
 Posts: 4264
 Joined: Oct. 2003
 | 
|  | Posted: April 15 2004,02:52 |  |  All,
 
 Below is the latest revision of the .start_synaptic script.  Based on tests performed by roberts, a change was needed in order to make it work with DSL version 0.6.3.
 
 Also, a RAMdisk size check was added to the program to prevent the LiveCD user from getting a mangled ramdisk.  At least 96MB of RAM is required in order to run this script if you are running DSL from LiveCD or as a frugal/poor man's install.  Keep in mind that if you only have 96MB of RAM available, you will not be able to use Synaptic to install any large programs.
 
 To use the script, do the following. Copy the text below and paste it into a word processor like scite or nano. Then save the file as .start_synaptic  in your /home/damnsmall directory.
 
 Note the dot "." in front of the word start. Then make the file executable by opening an Xterminal (rxvt) window and type:
 
 chmod 755 .start_synaptic
 
 Finally, to run the script, type in:
 
 ./.start_synaptic
 
 on a blank line inside the Xterminal (rxvt) window.
 
 Here is the script text that you need to copy:
 
 
 | 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.
 #
 # Original author:  cbagger01 from the Damn Small Linux forum
 # Rev 2 4/09/04
 #                   Revised to work with DSL version 0.6.1
 #                   Do not use with DSL versions older than 0.6
 #                   Added a ramdisk size check,
 #                   and changes for DSL version 0.6.3
 
 # 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. '
 # Make sure that there is enough RAM to install Synaptic
 # Ramdisk size must be 65MB or greater
 DISKSIZE=$(df -m /ramdisk | awk '(NR > 1) {printf("%d",$2)}')
 if [ $DISKSIZE -lt 65 ]
 then
 echo 'Your computer does not have enough RAM to use Synpatic'
 echo 'while running from the compressed filesystem.'
 echo 'Press ENTER to continue...'
 read CONTINUE
 rm /tmp/startsynaptic.tmp
 exit
 fi
 echo 'Creating a writable /usr tree on the RAM Disk...'
 cp -srd /KNOPPIX/usr/ /ramdisk
 ln -sf /ramdisk/usr/X11R6/lib/X11 /ramdisk/usr/lib/
 ln -sf /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 /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 /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 /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 /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...'
 rm -f /var/lib/dpkg
 export PATH=.:$PATH
 ln -s /bin/busybox tar
 dpkg-restore
 rm ~/tar
 fi
 
 # Install synaptic, the Debian package management GUI
 echo 'Downgrading apt back to version 0.5.4...'
 wget -c http://ftp.debian.org/debian/pool/main/a/apt/apt_0.5.4_i386.deb
 echo $'yes\n' | dpkg -i apt_0.5.4_i386.deb
 rm -rf apt_0.5.4_i386.deb
 echo $'yes\n' | apt-get -f install
 echo $'yes\n' | apt-get install apt-utils
 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
 
 | 
 |