Here is attempt at a kernel changer script, but be warned I had issues in librepup as noted earlier. It should work in any woof puppy built in 2015 or later (maybe a little earlier). depends on the 'Huge' kernel. (see woof-ce for explanation).
In saying that, we filter out old pups, full installs and live CD boots as obviously we can't write the z-drive and vmlinuz to an early enough part of a cd/dvd.
Tech note: it appends the DISTRO_IDSTRING to vmlinuz and zdrv_XXX_XXX.sfs
WARNING read the help! If not comfortable with recovering then don't do it until we find and figure out bugs! no responsibility accepted!
See this post for the newest gzip version
Code: Select all
#!/bin/bash
# this script changes a kernel in woof-ce based puppy linux
set -e
export TEXTDOMAIN=change_kernels
export OUTPUT_CHARSET=UTF-8
_msg() {
echo "<window title=\"$1\">
<vbox>
<frame>
<hbox space-expand=\"true\" space-fill=\"true\">
<text>
<label>\"$1 message:\"</label>
</text>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<text>
<label>\"$2\"</label>
</text>
</hbox>
</frame>
<hbox><button ok></button></hbox>
</vbox>
</window>"|gtkdialog -s -c
exit $3
}
[ -f /etc/DISTRO_SPECS ] && . /etc/DISTRO_SPECS || _msg Error "Your puppy is too old or broken" 65
[ -f /etc/rc.d/PUPSTATE ] && . /etc/rc.d/PUPSTATE || _msg Error "Your puppy is too old or broken" 66
case $PUPMODE in
2|3)_msg Error "Unfortunately this doesn't work in full installs" $PUPMODE;;
esac
[ "$PMEDIA" = "cd" ] && _msg Error "Unfortunately this doesn't work with live CD installs" 7
[ "$DISTRO_KERNEL_PET" = "Huge_Kernel" ] || _msg Error "Unfortunately this doesn't work with older puppy installs" 255
KERNEL_HOME=/initrd${PUP_HOME}${PSUBDIR}
DATE=`date +%y%m%d`
change() {
echo "$1" | grep -q 'vmlinuz' || _msg Error "Not a valid kernel file" 11
echo "$2" | grep -q 'sfs' || _msg Error "Not a valid module file" 12
mv $KERNEL_HOME/vmlinuz $KERNEL_HOME/vmlinuz.${DATE}
[ $? -ne 0 ] && _msg Error "Failed to move ${1##*/}" 13
mv $KERNEL_HOME/$DISTRO_ZDRVSFS $KERNEL_HOME/$DISTRO_ZDRVSFS.${DATE}
[ $? -ne 0 ] && _msg Error "Failed to move ${2##*/}" 14
cp -a "$1" $KERNEL_HOME/vmlinuz
[ $? -ne 0 ] && mv -f $KERNEL_HOME/vmlinuz.${DATE} $KERNEL_HOME/vmlinuz \
&& _msg Error "Failed to copy vmlinuz: restoring original" 15
cp -a "$2" $KERNEL_HOME/$DISTRO_ZDRVSFS
[ $? -ne 0 ] && mv -f $KERNEL_HOME/vmlinuz.${DATE} $KERNEL_HOME/vmlinuz \
&& _msg Error "Failed to copy $DISTRO_ZDRVSFS: restoring original" 16
echo -n $DISTRO_IDSTRING >> $KERNEL_HOME/vmlinuz
echo -n $DISTRO_IDSTRING >> $KERNEL_HOME/$DISTRO_ZDRVSFS
_msg Success "Now reboot to test your new kernel." 0
}
help_me() {
echo "HELP
WARNING!
You may render your system unbootable!
Find a vmlinuz file for the first entry box
Find a zdrive file (which may have an obscure name if you
built it in kernel-kit, so long as 'sfs' is in the name it's ok)
for the second entry box.
Hit ok.
The distro ID string is appended to the vmlinuz and zdrive.
Hopefully you can reboot.
IF IT FAILS
There are backups of the old vmlinuz and zdrive in place appended
with the day you did the operation's date. Remove the date
and reboot.
GOOD LUCK
bugs to 01micko @ murga forum
GPL2
While all care is taken, no responsibility accepted." >> /tmp/kernelhelp.txt
defaulttextviewer /tmp/kernelhelp.txt
rm /tmp/kernelhelp.txt
}
export -f help_me
export GUI="<window title=\"Change Kernels\">
<vbox>
<frame>
<hbox space-expand=\"true\" space-fill=\"true\">
<text use-markup=\"true\">
<label>\"<big>$(gettext "WARNING:")</big> $(gettext "Please read the Help")\"</label>
</text>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<text><label>$(gettext "Choose the location of kernel file named") vmlinuz</label></text>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<entry accept=\"file\">
<variable>VMLINUZ</variable>
</entry>
<button>
<input file stock=\"gtk-open\"></input>
<action type=\"fileselect\">VMLINUZ</action>
</button>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<text><label>$(gettext "Find the module file named") $DISTRO_ZDRVSFS $(gettext "or perhaps some obscure name if built with kernel-kit. You can try other kernels built in other Puppies")</label></text>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<entry accept=\"file\">
<variable>MODULES</variable>
</entry>
<button>
<input file stock=\"gtk-open\"></input>
<action type=\"fileselect\">MODULES</action>
</button>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<text>
<label>$(gettext "We have found that your kernel is located at:")</label>
</text>
</hbox>
<hbox space-expand=\"true\" space-fill=\"true\">
<text use-markup=\"true\">
<label>\"<b>$KERNEL_HOME</b>\"</label>
</text>
</hbox>
</frame>
<hbox>
<button>
<label>$(gettext "Help")</label>
<action>help_me</action>
</button>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>"
eval $(gtkdialog -p GUI -c)
case $EXIT in
OK) change $VMLINUZ $MODULES;;
*)exit 0;;
esac
echo $KERNEL_HOME