summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-04-17 02:25:08 +0200
committer Eric Hameleers <alien@slackware.com>2016-04-17 02:25:08 +0200
commit1adfa329bd1a10ba89267ed3e5ed4b47b34a6f30 (patch)
treee11b352bc782ff3d06c391b55b8a2d3123a678b4
parent367bbd16d5cabb7da52f863ae78cf66c4d45e046 (diff)
downloadliveslak-1adfa329bd1a10ba89267ed3e5ed4b47b34a6f30.tar.gz
liveslak-1adfa329bd1a10ba89267ed3e5ed4b47b34a6f30.tar.xz
Add a post-install customization hook to 'setup2hd'.
A new file 'setup2hd.local' has been added to the liveslak sources. If you do not touch that one, it will be copied to: /usr/share/${LIVEMAIN}/setup2hd.$DISTRO.sample and serve as just that, a sample script. If on the other hand you rename the file to 'setup2hd.$DISTRO' before generating your ISO image ($DISTRO being the name of your own distro, like 'CINELIVE'), then this file will be installed in the ISO as /usr/share/${LIVEMAIN}/setup2hd.$DISTRO and this will be sourced by 'setup2hd' providing you a custom post-install customization hook for your own Live distro. Usage instructions are inside 'setup2hd.local'.
-rwxr-xr-xmake_slackware_live.sh23
-rwxr-xr-xsetup2hd83
-rw-r--r--setup2hd.local80
3 files changed, 156 insertions, 30 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 7734675..b92465c 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -1138,6 +1138,29 @@ if [ -f ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* ]; then
-e "s/@VERSION@/$VERSION/g" \
> ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd
chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd
+ # Slackware Live HD post-install customization hook:
+ if [ -f ${LIVE_TOOLDIR}/setup2hd.local ]; then
+ # The '.local' suffix means: install it as a sample file only:
+ HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.local"
+ HOOK_DST="${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/setup2hd.$DISTRO.sample"
+ elif [ -f ${LIVE_TOOLDIR}/setup2hd.$DISTRO ]; then
+ # Install the hook; the file will be sourced by "setup2hd".
+ HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.$DISTRO"
+ HOOK_DST="${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/setup2hd.$DISTRO"
+ fi
+ cat ${HOOK_SRC} | sed \
+ -e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \
+ -e "s/@DISTRO@/$DISTRO/g" \
+ -e "s/@CDISTRO@/${DISTRO^}/g" \
+ -e "s/@UDISTRO@/${DISTRO^^}/g" \
+ -e "s/@KVER@/$KVER/g" \
+ -e "s/@LIVEDE@/$LIVEDE/g" \
+ -e "s/@LIVEMAIN@/$LIVEMAIN/g" \
+ -e "s/@MARKER@/$MARKER/g" \
+ -e "s/@SL_VERSION@/$SL_VERSION/g" \
+ -e "s/@VERSION@/$VERSION/g" \
+ > ${HOOK_DST}
+ chmod 644 ${HOOK_DST}
fi
# Add the documentation:
diff --git a/setup2hd b/setup2hd
index a17c556..eefb154 100755
--- a/setup2hd
+++ b/setup2hd
@@ -217,48 +217,71 @@ Press ENTER to return to the main menu." 16 68
) | dialog --title "INSTALLING @UDISTRO@ LIVE (@LIVEDE@) TO DISK" --gauge \
"\nProcessing ${TOT_MODS} @CDISTRO@ Live modules ($(( $DU_LIVE/1024 )) MB)" 8 65
- # Re-use some of the custom configuration from 0099-@DISTRO@_zzzconf-*.sxz
- # (some of these may not be present but the command will not fail):
- dialog --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \
- "\nCopying Live modifications to hard disk ..." 5 65
- # Do not overwrite a custom keymap:
- if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then
- unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
- /etc/rc.d/rc.keymap
- fi
- unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
- /etc/profile.d/lang.sh \
- /etc/slackpkg \
- /etc/X11/xorg.conf.d/30-keyboard.conf \
- /etc/X11/xdm/liveslak-xdm
- # Point xdm to the custom /etc/X11/xdm/liveslak-xdm/xdm-config:
- sed -i ${T_PX}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/xdm/liveslak-xdm/xdm-config,'
- # Remove the marker file from the filesystem root:
- rm -f ${T_PX}/@MARKER@
-
- cat << EOF > $TMP/tempmsg
+ #
+ # Live OS Post Install routine. If you want, you can override this routine
+ # by (re-)defining this function "live_post_install()" in a file called
+ # "/usr/share/@LIVEMAIN@/setup2hd.@DISTRO@".
+ #
+
+ live_post_install () {
+ # Re-use some of the custom configuration from 0099-@DISTRO@_zzzconf-*.sxz
+ # (some of these may not be present but the command will not fail):
+ dialog --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \
+ "\nCopying Live modifications to hard disk ..." 5 65
+ # Do not overwrite a custom keymap:
+ if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then
+ unsquashfs -f -dest $T_PX \
+ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
+ /etc/rc.d/rc.keymap
+ fi
+ unsquashfs -f -dest $T_PX \
+ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
+ /etc/X11/xdm/liveslak-xdm \
+ /etc/X11/xorg.conf.d/30-keyboard.conf \
+ /etc/inittab \
+ /etc/profile.d/lang.sh \
+ /etc/rc.d/rc.font \
+ /etc/rc.d/rc.gpm \
+ /etc/slackpkg
+ # Point xdm to the custom /etc/X11/xdm/liveslak-xdm/xdm-config:
+ sed -i ${T_PX}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/xdm/liveslak-xdm/xdm-config,'
+ # Remove the marker file from the filesystem root:
+ rm -f ${T_PX}/@MARKER@
+
+ cat << EOF > $TMP/tempmsg
@CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive!
We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available).
- If present, the following files were copied from the Live OS to your harddisk:
- /etc/profile.d/lang.sh
- /etc/rc.d/rc.keymap
- /etc/slackpkg
- /etc/X11/xorg.conf.d/30-keyboard.conf
- /etc/X11/xdm/liveslak-xdm
+ The following configuration was copied from the Live OS to your harddisk:
+ - console font
+ - default runlevel
+ - keyboard layout
+ - language setting
After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this:
# unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz
EOF
- dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \
- 20 65
- rm $TMP/tempmsg
+ dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \
+ 20 65
+ rm $TMP/tempmsg
+
+ MAINSELECT="CONFIGURE"
+ }
+
+ if [ -f /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@ ]; then
+ # If the setup2hd post-configuration file exists, source it.
+ # The file should re-define the live_post_install() function.
+ . /usr/share/@LIVEMAIN@/setup2hd.@DISTRO@
+ fi
+
+ # Now, execute the function - either our own built-in version
+ # or the re-defined function from the custom setup2hd.@DISTRO@ file.
+ live_post_install
# --------------------------------------------- #
# Slackware Live Edition - end install to disk: #
# --------------------------------------------- #
- MAINSELECT="CONFIGURE"
fi
if [ "$MAINSELECT" = "CONFIGURE" ]; then
diff --git a/setup2hd.local b/setup2hd.local
new file mode 100644
index 0000000..059b8cd
--- /dev/null
+++ b/setup2hd.local
@@ -0,0 +1,80 @@
+# -------------------------------------------------------------------------
+# Live OS Post Install routine.
+# This is where you can override the default post-installation routine
+# by (re-)defining the function "live_post_install()".
+# -------------------------------------------------------------------------
+
+# The example below is an extension to what the setup2hd script does.
+# By default, setup2hd will only copy a few customizations from the Live OS
+# to the hard drive. Things that do *not* get installed are (among others):
+# - the 'live' user plus homedirectory
+# - the runlevel (Slackware Live starts in runlevel 4)
+# - sudo and su configuration
+# These *are* copied in the example below.
+
+live_post_install () {
+ # Re-use some of the custom configuration from 0099-@DISTRO@_zzzconf-*.sxz
+ # (some of these may not be present but the command will not fail):
+ dialog --title "POST-INSTALL @UDISTRO@ LIVE (@LIVEDE@) DATA" --infobox \
+ "\nCopying Live modifications to hard disk ..." 5 65
+ # Do not overwrite a custom keymap:
+ if [ ! -f $T_PX/etc/rc.d/rc.keymap ]; then
+ unsquashfs -f -dest $T_PX \
+ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
+ /etc/rc.d/rc.keymap
+ fi
+ unsquashfs -f -dest $T_PX \
+ /mnt/livemedia/@LIVEMAIN@/system/0099*zzzconf*.sxz \
+ /etc/X11/xdm/liveslak-xdm \
+ /etc/X11/xorg.conf.d/30-keyboard.conf \
+ /etc/group \
+ /etc/hardwareclock \
+ /etc/inittab \
+ /etc/localtime* \
+ /etc/passwd \
+ /etc/profile.d/lang.sh \
+ /etc/rc.d/rc.font \
+ /etc/rc.d/rc.gpm \
+ /etc/shadow \
+ /etc/skel \
+ /etc/slackpkg \
+ /etc/suauth \
+ /etc/sudoers \
+ /home/live
+ # Point xdm to the custom /etc/X11/xdm/liveslak-xdm/xdm-config:
+ sed -i ${T_PX}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/xdm/liveslak-xdm/xdm-config,'
+ # Remove the marker file from the filesystem root:
+ rm -f ${T_PX}/@MARKER@
+
+ cat << EOF > $TMP/tempmsg
+
+ @CDISTRO@ Live Edition (@LIVEDE@) has been installed to your hard drive!
+ We installed the ${ACT_MODS} active modules (out of ${TOT_MODS} available).
+ After rebooting, your installed computer will look exactly like the Live OS.
+
+ After finishing system configuration and before rebooting, you can add any further Live modules from /@LIVEMAIN@/addons/ and /@LIVEMAIN@/optional/ to your hard drive, using a command similar to this:
+ # unsquashfs -f -dest $T_PX /mnt/livemedia/@LIVEMAIN@/addons/mymodule.sxz
+
+EOF
+ dialog --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \
+ 20 65
+ rm $TMP/tempmsg
+
+ # Setting MAINSELECT to "CONFIGURE" will call the usual Slackware
+ # setup scripts next (timeconfig, netconfig, mouseconfig etc...).
+ # If you want to skip all that and do your own config instead,
+ # add it right below these lines and then set MAINSELECT to
+ # "EXIT" instead of "CONFIGURE".
+
+ # ... one thing you must NOT FORGET TO DO is:
+ #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "#/dev/cdrom" "/mnt/cdrom" "auto" "noauto,owner,ro,comment=x-gvfs-show" "0" "0" >> $T_PX/etc/fstab
+ #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "/dev/fd0" "/mnt/floppy" "auto" "noauto,owner" "0" "0" >> $T_PX/etc/fstab
+ #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "devpts" "/dev/pts" "devpts" "gid=5,mode=620" "0" "0" >> $T_PX/etc/fstab
+ #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "proc" "/proc" "proc" "defaults" "0" "0" >> $T_PX/etc/fstab
+ #printf "%-16s %-16s %-11s %-16s %-3s %s\n" "tmpfs" "/dev/shm" "tmpfs" "defaults" "0" "0" >> $T_PX/etc/fstab
+
+ # Remember, change to "EXIT" if you want to skip Slackware's post-config!
+ MAINSELECT="CONFIGURE"
+
+} # END live_post_install()
+