PDA

View Full Version : Small patch for knoppix-autoconfig



bfree
03-31-2004, 03:30 AM
Currently if you have myconf=scan (or one of the equivalents =scan) then you will get an error message about failing to mount /dev/ as AES256 (really annoying if you've used splash as if seems to lock the machine), the problem being that knoppix-autoconfig doesn't check to see if it found a config and hence tries to mount an invalid point. A small patch to knoppix-autoconfig will sort it out. Find the following section:

MYCONFDIR="$(findfile knoppix.sh)"
MYCONFDEVICE="${MYCONFDIR##/mnt/}"
MYCONFDEVICE="/dev/${MYCONFDEVICE%%/*}"
MYCONFMOUNTPOINT="/mnt/${MYCONFDEVICE##/dev/}"
MYCONFDIR="${MYCONFMOUNTPOINT}"
And change it to:

MYCONFDIR="$(findfile knoppix.sh)"
if [ -n "$MYCONFDIR" ]; then
MYCONFDEVICE="${MYCONFDIR##/mnt/}"
MYCONFDEVICE="/dev/${MYCONFDEVICE%%/*}"
MYCONFMOUNTPOINT="/mnt/${MYCONFDEVICE##/dev/}"
MYCONFDIR="${MYCONFMOUNTPOINT}"
else
FOUND_CONFIG="none"
fi

bfree
04-23-2004, 06:12 AM
Well while the above works fine and dandy, if you have scan setup by default but actually you don't want to use any home or conf what do you do? Well why not also add the following patch so you can do home|myconf=no|none!

Change the home section to
___________________________
[Aa][Uu][Tt][Oo]|[Ss][Cc][Aa][Nn]|[Ff][Ii][Nn][Dd])
MYHOMEDIR="$(findfile knoppix.img)"
MYHOMEDEVICE="${MYHOMEDIR##/mnt/}"
MYHOMEDEVICE="/dev/${MYHOMEDEVICE%%/*}"
MYHOMEMOUNTPOINT="/mnt/${MYHOMEDEVICE##/dev/}"
;;
[Nn][Oo]|[Nn][Oo][Nn][Ee])
echo "${GREEN}Home switched off.${NORMAL}"
;;
*)
echo "${CRE}${RED}Invalid ${CYAN}home=${RED} option '$HOMEDIR' specified (must
start with /dev/ or /mnt/ or 'scan').${NORMAL}"
echo "${CRE}${RED}Option ignored.${NORMAL}"
;;
esac
fi
___________________________

and change the conf section to
___________________________
[Aa][Uu][Tt][Oo]|[Ss][Cc][Aa][Nn]|[Ff][Ii][Nn][Dd])
MYCONFDIR="$(findfile knoppix.sh)"
if [-n "$MYCONFDIR" ]; then
MYCONFDEVICE="${MYCONFDIR##/mnt/}"
MYCONFDEVICE="/dev/${MYCONFDEVICE%%/*}"
MYCONFMOUNTPOINT="/mnt/${MYCONFDEVICE##/dev/}"
MYCONFDIR="${MYCONFMOUNTPOINT}"
else
FOUND_CONFIG="none"
fi
;;
[Nn][Oo]|[Nn][Oo][Nn][Ee])
echo "${GREEN}Configdir turned off.${NORMAL}"
FOUND_CONFIG="off"
;;
*)
echo "${CRE}${RED}Invalid configdir '$MYCONFDIR' specified (must start with /de
v/ or /mnt/ or 'scan').${NORMAL}"
echo "${CRE}${RED}Option ignored.${NORMAL}"
FOUND_CONFIG="invalid"
;;
esac
___________________________

I've also come across what seems to be a problem concerning timezones. I was trying to figure out why my remaster had the time an hour early, even if I was in the right timezone! I think it's because the system clock is set ignorant of the timezone because hwclock is called in knoppix-autoconfig when TZ has not been exported. Now ordering gets tricky so I'm not 100% certain of how this should best be addressed. I think the answer is to export TZ after the tz cheatcode has been picked up (and localtime set) and then run hwclock there, that way it will see the correct TZ (or the best it's going to) when it sets the system clock. I assume there would also be no problem removing the first running of hwclock Sorry I'm posting these before I've tested them (when I can get back to it, tonight or perhaps earlier), but with 3.4 so imminent I wanted to mention them as soon as I came up with/across them.

arkaine23
04-24-2004, 01:28 AM
I did something simialr to this so that it would not prompt the user to try to rescan for the encrypted FS if no persistent home was found where I had set home=scan as a default boot parameter in my remaster, Overclockix.

Your code is cleaner than mine though.

bfree
04-24-2004, 03:21 PM
[Aa][Uu][Tt][Oo]|[Ss][Cc][Aa][Nn]|[Ff][Ii][Nn][Dd])
MYCONFDIR="$(findfile knoppix.sh)"
if [-n "$MYCONFDIR" ]; then
MYCONFDEVICE="${MYCONFDIR##/mnt/}"

Ooops, a small error got in there somehow (no space between [ and -n)! Should be:


[Aa][Uu][Tt][Oo]|[Ss][Cc][Aa][Nn]|[Ff][Ii][Nn][Dd])
MYCONFDIR="$(findfile knoppix.sh)"
if [ -n "$MYCONFDIR" ]; then
MYCONFDEVICE="${MYCONFDIR##/mnt/}"