diff options
author | 2021-03-21 17:24:51 +0100 | |
---|---|---|
committer | 2021-03-21 19:24:03 +0100 | |
commit | 60ecb8b6d85b70d07e9aacb12771dde7cd86adf3 (patch) | |
tree | 8ae237165c1c150b92f7d0508b394a43001078b0 /defaults | |
parent | initrd.scripts: Add is_quiet() function (diff) | |
download | genkernel-60ecb8b6d85b70d07e9aacb12771dde7cd86adf3.tar.gz genkernel-60ecb8b6d85b70d07e9aacb12771dde7cd86adf3.tar.bz2 genkernel-60ecb8b6d85b70d07e9aacb12771dde7cd86adf3.zip |
linuxrc: Move global variables to initrd.defaults
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/initrd.defaults | 17 | ||||
-rw-r--r-- | defaults/initrd.scripts | 4 | ||||
-rw-r--r-- | defaults/linuxrc | 25 | ||||
-rw-r--r-- | defaults/login-remote.sh | 8 |
4 files changed, 24 insertions, 30 deletions
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 88495391..9ebeeccf 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -46,15 +46,21 @@ WHITE="[1;37m" # printf "[H[J" KV=$(uname -r) -KMAJOR=$(echo $KV | cut -f1 -d.) -KMINOR=$(echo $KV | cut -f2 -d.) +KMAJOR=$(echo ${KV} | cut -f1 -d.) +KMINOR=$(echo ${KV} | cut -f2 -d.) KVER="${KMAJOR}.${KMINOR}" MISCOPTS='debug detect' -QUIET='' +CONSOLE_LOGLEVEL=$(cut -b1 /proc/sys/kernel/printk 2>/dev/null || echo 7) + +QUIET=0 ROOT_LINKS='bin sbin lib lib32 lib64 boot usr opt emul' ROOT_TREES='etc root home var' +FAKE_ROOT='' +FAKE_INIT='' +FAKE_ROOTFLAGS='' + REAL_ROOT='' NEW_ROOT='/newroot' no_umounts='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino' @@ -88,6 +94,8 @@ GK_NET_TIMEOUT_DAD=10 GK_NET_TIMEOUT_DECONFIGURATION=10 GK_NET_TIMEOUT_DHCP=10 GK_NET_TIMEOUT_INTERFACE=10 +GK_META_BUILD_DATE=$(cat /etc/build_date 2>/dev/null || echo "Unknown") +GK_META_VERSION=$(cat /etc/build_id 2>/dev/null || echo "Unknown") GK_PRESERVE_RUN=1 GK_PROMPT_FILE='/tmp/current_prompt' GK_PROMPT_TIMEOUT=0 @@ -107,11 +115,14 @@ CRYPT_ROOT_KEYDEV_FSTYPE='auto' CRYPT_ROOT_KEYFILE='/tmp/root.key' CRYPT_ROOT_OPENED_LOCKFILE='/tmp/ROOT.opened' CRYPT_ROOT_OPTIONS='' +CRYPT_SILENT=0 CRYPT_SWAP_KEYDEV_FSTYPE='auto' CRYPT_SWAP_KEYFILE='/tmp/swap.key' CRYPT_SWAP_OPENED_LOCKFILE='/tmp/SWAP.opened' CRYPT_SWAP_OPTIONS='' +ROOTFSTYPE='auto' + ZFS_ENC_ENV_FILE='/etc/ZFS_ENC_ENV.conf' ZFS_ENC_OPENED_LOCKFILE='/tmp/ZFS.opened' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index cbeb6bc2..fb6f3141 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1054,8 +1054,8 @@ run_shell() { export PS1='rescueshell \w \# ' echo - GOOD=${BLUE} good_msg "${NORMAL}Welcome to ${BOLD}${gk_ver}${NORMAL} (${gk_build_date}) ${BOLD}rescue shell${NORMAL}!" 0 - GOOD=${BLUE} good_msg "${NORMAL}...running Linux kernel ${BOLD}${kernel_ver}${NORMAL}" 0 + GOOD=${BLUE} good_msg "${NORMAL}Welcome to ${BOLD}${GK_META_VERSION}${NORMAL} (${GK_META_BUILD_DATE}) ${BOLD}rescue shell${NORMAL}!" 0 + GOOD=${BLUE} good_msg "${NORMAL}...running Linux kernel ${BOLD}${KV}${NORMAL}" 0 echo # Avoid /dev/{console,tty0} due to "can't access tty; job control turned off" problem; diff --git a/defaults/linuxrc b/defaults/linuxrc index 2bb4baed..bd6d192d 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -51,21 +51,8 @@ fi # Set up symlinks run busybox --install -s -console_loglevel="$(cut -b1 /proc/sys/kernel/printk 2>/dev/null || echo 7)" -gk_ver="$(cat /etc/build_id)" -gk_build_date="$(cat /etc/build_date)" -kernel_ver="$(uname -r)" - -CMDLINE=$(cat /proc/cmdline) -# Scan CMDLINE for any specified real_root= or cdroot arguments -FAKE_ROOT='' -FAKE_INIT='' -FAKE_ROOTFLAGS='' -ROOTFSTYPE='auto' -CRYPT_SILENT=0 -QUIET='' - -run mkdir -p /etc/cmdline /etc/modprobe.d +# Handle kernel command-line parameters +CMDLINE=$(cat /proc/cmdline 2>/dev/null) for x in ${CMDLINE} do case "${x}" in @@ -468,7 +455,7 @@ done # Prevent superfluous printks from being printed to the console echo ${GK_CONSOLE_LOGLEVEL} > /proc/sys/kernel/printk -good_msg "${gk_ver} (${gk_build_date}). Linux kernel ${kernel_ver}" +good_msg "${GK_META_VERSION} (${GK_META_BUILD_DATE}). Linux kernel ${KV}" if [ "${GK_BOOTFONT_DISABLED}" = '0' -a -e /lib/console/font ] then @@ -1381,11 +1368,11 @@ do fi done -if [[ "${console_loglevel}" != "${GK_CONSOLE_LOGLEVEL}" ]] +if [[ "${CONSOLE_LOGLEVEL}" != "${GK_CONSOLE_LOGLEVEL}" ]] then good_msg "Restoring console log level (${console_loglevel}) ..." - echo ${console_loglevel} > /proc/sys/kernel/printk \ - && log_msg "COMMAND: 'echo \"${console_loglevel}\" > /proc/sys/kernel/printk'" + echo ${CONSOLE_LOGLEVEL} > /proc/sys/kernel/printk \ + && log_msg "COMMAND: 'echo \"${CONSOLE_LOGLEVEL}\" > /proc/sys/kernel/printk'" fi good_msg "Switching to real root: switch_root ${CHROOT} ${init} ${init_opts}" diff --git a/defaults/login-remote.sh b/defaults/login-remote.sh index 8eee09ad..4664d7bd 100644 --- a/defaults/login-remote.sh +++ b/defaults/login-remote.sh @@ -81,14 +81,10 @@ else # Don't log further remote shell output GK_INIT_LOG= - gk_ver="$(cat /etc/build_id)" - gk_build_date="$(cat /etc/build_date)" - kernel_ver="$(uname -r)" - export PS1='remote rescueshell \w \# ' - GOOD=${BLUE} good_msg "${NORMAL}Welcome to ${BOLD}${gk_ver}${NORMAL} (${gk_build_date}) ${BOLD}remote rescue shell${NORMAL}!" - GOOD=${BLUE} good_msg "${NORMAL}...running Linux kernel ${BOLD}${kernel_ver}${NORMAL}" + GOOD=${BLUE} good_msg "${NORMAL}Welcome to ${BOLD}${GK_META_VERSION}${NORMAL} (${GK_META_BUILD_DATE}) ${BOLD}remote rescue shell${NORMAL}!" + GOOD=${BLUE} good_msg "${NORMAL}...running Linux kernel ${BOLD}${KV}${NORMAL}" echo good_msg "${NORMAL}The lockfile '${BOLD}${GK_SSHD_LOCKFILE}${NORMAL}' was created." good_msg "${NORMAL}In order to resume boot process, run '${BOLD}resume-boot${NORMAL}'." |