diff options
author | Eric Hameleers <alien@slackware.com> | 2018-09-04 21:14:45 +0200 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-09-04 21:14:45 +0200 |
commit | f1049072873fdb3cdb3c42975164695ecb1d9f78 (patch) | |
tree | 58032e370f8ab7e3b9f1679314254ae2658bafe5 /liveinit.tpl | |
parent | 1f12e68439985651f0841fca8bb30a52769c1cbf (diff) | |
download | liveslak-f1049072873fdb3cdb3c42975164695ecb1d9f78.tar.gz liveslak-f1049072873fdb3cdb3c42975164695ecb1d9f78.tar.xz |
On loading of 'distro_os.cfg' do not overwrite pre-defined values
Variables defined on the boot commandline have preference over
any variable set in the .cfg file.
Diffstat (limited to 'liveinit.tpl')
-rwxr-xr-x | liveinit.tpl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/liveinit.tpl b/liveinit.tpl index 4702600..58011fb 100755 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -706,13 +706,22 @@ if [ "$RESCUE" = "" ]; then # liveslak can optionally load a OS config file "@DISTRO@_os.cfg" # which contains "VARIABLE=value" lines, where VARIABLE is one of # the following variables that are used below in the live init script: - # BLACKLIST, INIT, KEYMAP, LIVE_HOSTNAME, LOAD, LOCALE, LUKSVOL, + # BLACKLIST, KEYMAP, LIVE_HOSTNAME, LOAD, LOCALE, LUKSVOL, # NOLOAD, RUNLEVEL, TWEAKS, TZ, XKB. if [ -z "$CFGACTION" ]; then - # Read OS configuration from disk file if present + # Read OS configuration from disk file if present and set any variable + # from that file if it has not yet been defined in the init script # (prevent this by adding 'cfg=skip' to the boot commandline). if [ -f "/mnt/media/${LIVEMAIN}/${DISTROCFG}" ]; then - source /mnt/media/${LIVEMAIN}/${DISTROCFG} + echo "${MARKER}: Reading config from /${LIVEMAIN}/${DISTROCFG}" + for LIVEPARM in \ + BLACKLIST KEYMAP LIVE_HOSTNAME LOAD LOCALE LUKSVOL \ + NOLOAD RUNLEVEL TWEAKS TZ XKB ; + do + if [ -n "${LIVEPARM}" ]; then + eval $(grep -w ${LIVEPARM} /mnt/media/${LIVEMAIN}/${DISTROCFG}) + fi + done fi elif [ "$CFGACTION" = "write" ]; then # Write liveslak OS parameters to disk: @@ -722,7 +731,7 @@ if [ "$RESCUE" = "" ]; then else echo "${MARKER}: Writing config to /${LIVEMAIN}/${DISTROCFG}" for LIVEPARM in \ - BLACKLIST INIT KEYMAP LIVE_HOSTNAME LOAD LOCALE LUKSVOL \ + BLACKLIST KEYMAP LIVE_HOSTNAME LOAD LOCALE LUKSVOL \ NOLOAD RUNLEVEL TWEAKS TZ XKB ; do if [ -n "$(eval echo \$$LIVEPARM)" ]; then |