LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   Saving Knoppix configs for two versions of Knoppix (https://www.linuxquestions.org/questions/linux-distributions-5/saving-knoppix-configs-for-two-versions-of-knoppix-390290/)

ninjabob7 12-07-2005 05:47 PM

Saving Knoppix configs for two versions of Knoppix
 
I use two versions of Knoppix: 4.0.2 and 3.8.2. The problem I had was how to put configuration files for both on the same partition. Since the names of the files, by default, are knoppix.sh and configs.tbz, and the config boot parameter only works with the root directory, I had to figure out how to put both configs in the same directory. After some exploring and tinkering, I modified my knoppix.sh so it would detect what version of knoppix was running and extract a different file depending on the version. Here's the modified knoppix.sh:
Code:

#!/bin/sh
[ "`id -u`" = "0" ] || { echo "You need root privileges to modify the system!" >&2 ; exit 1; }
VERSION=""
if grep 3.8.2 /cdrom/boot/isolinux/boot.msg > /dev/null; then
VERSION=3.8.2
fi
if grep 4.0.2 /cdrom/boot/isolinux/boot.msg > /dev/null; then
VERSION=4.0.2
fi
echo " [1mRunning Knoppix version $VERSION. [0m"
if [ $VERSION = 3.8.2 ]; then
[ -d "$1" ] && CONFIGS="$1/knoppix-3.8.2-configs.tbz"
elif [ $VERSION = 4.0.2 ]; then
[ -d "$1" ] && CONFIGS="$1/knoppix-4.0.2-configs.tbz"
fi
[ -f "$CONFIGS" ] || CONFIGS="/cdrom/KNOPPIX/configs.tbz"
[ -f "$CONFIGS" ] || CONFIGS="/mnt/floppy/configs.tbz"
if [ -f "$CONFIGS" ]; then
echo " [1mExtracting config archive $CONFIGS... [0m"
tar -jpPtf "$CONFIGS" | while read i; do rm -f "$i"; done
tar -jpPxf "$CONFIGS" ; chown -R knoppix.knoppix /home/knoppix
fi
killall pump 2>/dev/null && sleep 2 && killall -9 pump 2>/dev/null && sleep 2
echo " [1mStarting daemons... [0m"
for i in  ifupdown networking; do [ -x /etc/init.d/$i ] && /etc/init.d/$i start; done

To set this up, run the "Save Knoppix Configuration", rename configs.tbz, and overwrite knoppix.sh with this file. You will probably want to back it up so you can fix it quickly the next time you save the configs.
I hope this will be useful to someone.


All times are GMT -5. The time now is 07:49 AM.