DSL Ideas and Suggestions :: Install Script for Synaptic



Hi All,

Below you will find an install script for Synaptic, the Easy-to-use package management program (apt-get interface) for Debian-based Linux systems like Damn Small Linux. You can use Synaptic to easily install over 8,000 new programs from the Internet.

While Synaptic is a great program to have if you are using a Hard Disk installed version of DSL, this script has one additional really cool feature:

If you have enough RAM (in my case, 256MB. But I think it will also work with computers that only have 128MB), this install script will allow you to temporarily install new programs into the RAMDISK when you are running DSL from the LiveCD.

This means that with a fast internet connection, you can quickly install those programs that you want but are not included with the base install CD. For example, if you need LinNeighborhood, or if you want your old Nedit program back, just select it from the menu and push the PROCEED button.

It's also a great way to try out some of the available programs without messing up your hard disk installed OS. Instead, just run DSL from the live CD and install the programs to RAMDISK. If you mess up your RAMDISK, who cares? Just reboot the computer and start over.

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

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.

Good Luck.

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.
# 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

It took me a while to cut and paste this using dillo, so heres a separate file.

try wget http://www.moatfarm.org/start_synaptic.txt

Thanks for the script cbagger. Maybe it will be included in a future version?

(-maybe it already is, im still on 4.1 But it works great.-)

chuck54,

Thank you for putting a text version of the script out there for people to grab.

Unfortunately, in your text file it appears that double lines were pasted into the text file below the "# Restart the xtdesktop icons if needed" section.

The "then" command line appears twice.

I did not check the entire script for additional syntax errors, but that one jumped out at me when I read it.

The file www.moatfarm.com/start_synaptic.txt is updated now. If you downloaded it before 8:09pm GMT on the 29th of december, it is broken as cbagger said.  Sorry if that caused any one any trouble.

head wall contact

All - Beginner alert!

When I type ./ .start_synaptic

I get bash: ./: is a directory

Can you help? Thanks

Chris

Next Page...
original here.