Release new version 0.22.0 master v0.22.0
authorMichael Prokop <mika@grml.org>
Fri, 2 Feb 2024 15:49:46 +0000 (16:49 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 2 Feb 2024 15:49:46 +0000 (16:49 +0100)
autoconfig
autoconfig.functions
debian/changelog
debian/control
grml-autoconfig
systemd/grml-autoconfig.service

index b98e4ca..7846e8b 100644 (file)
@@ -57,7 +57,7 @@ CONFIG_DEBNET='yes'           # search for /etc/network/interfaces on partitions
 CONFIG_DEBS='yes'             # check for bootoption debs for installing .debs
 CONFIG_DISPLAY_SSH_FINGERPRINTS='yes' # display SSH server key fingerprints
 CONFIG_DISTRI='yes'           # support some customization via bootoption distri
-CONFIG_DMRAID='yes'           # support for dmraid
+CONFIG_EASTEREGG='yes'        # easteregg
 CONFIG_EXTRACT='yes'          # specify which (only in combination with bootparam myconfig/netconfig useful)
 CONFIG_FINDDCSDIR='yes'       # search for a debs, config, scripts directory
 CONFIG_HOMEDIR='yes'          # check for persistent homedir option
index e659549..3bab753 100755 (executable)
@@ -184,7 +184,8 @@ KVM=false
 VIRTUALBOX=false
 VMWARE=false
 
-if vmware-detect &>/dev/null; then
+if virt-what 2>/dev/null | grep -q 'vmware' || \
+  imvirt 2>/dev/null | grep -iq "vmware" ; then
   VIRTUAL=true; VMWARE=true; VIRTUAL_ENV='VMware'
 fi
 
@@ -212,12 +213,8 @@ fi
 config_log(){
 if checkbootparam 'log' || checkbootparam 'debug' ; then
    export DEBUG="/tmp/grml.log.`date +%Y%m%d`"
-   touch $DEBUG
-   einfo "Bootparameter log found. Log files: ${DEBUG} and /var/log/boot"
-   eindent
-     einfo "Starting bootlogd." # known to be *very* unreliable :(
-     bootlogd -r -c >>$DEBUG 2>&1 ; eend $?
-   eoutdent
+   touch "${DEBUG}"
+   einfo "Bootparameter log found, debug log file from grml-autoconfig available at '${DEBUG}'"
 else
    DEBUG="/dev/null"
 fi
@@ -908,19 +905,23 @@ fi # -z $INSTALLED
 
 # {{{ CPU-detection
 config_cpu(){
-if checkbootparam 'nocpu'; then
-  ewarn "Skipping CPU detection as requested on boot commandline." ; eend 0
-  return 0
-fi
+  if checkbootparam 'nocpu'; then
+    ewarn "Skipping CPU detection as requested on boot commandline." ; eend 0
+    return 0
+  fi
 
-if [[ $(grep -c processor /proc/cpuinfo) -gt 1 ]] ; then
-   einfo "Found CPU:"
-   CPU=$(awk -F: '/^processor/{printf "        Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>>$DEBUG)
-   echo $CPU | sed 's/ \{1,\}/ /g'
-   eend 0
-else
-   einfo "Found CPU: `awk -F: '/^processor/{printf " Processor"$2" is"};/^model name/{printf $2};/^vendor_id/{printf vendor};/^cpu MHz/{printf " %dMHz",int($2)};/^cache size/{printf ","$2" Cache"};/^$/{print ""}' /proc/cpuinfo 2>>$DEBUG` " ; eend 0
-fi
+  if ! [ -x "$(which lscpu)" ] ; then
+    ewarn "Skipping CPU detection due to lack of lscpu."; eend 0
+    return 0
+  fi
+
+  local cpu_info num_cpus
+
+  cpu_info="$(lscpu | sed -n '/^Model name:/s/[^:]*:\s*//p')"
+  num_cpus=$(grep -c processor /proc/cpuinfo)
+
+  einfo "Found ${num_cpus} CPU(s): ${cpu_info}"
+  eend 0
 }
 # }}}
 
@@ -1411,7 +1412,7 @@ else
     else
       eindent
       einfo "debs, config, scripts are read from $DCSDEVICE." ; eend 0
-      DCSDIR="$(< /proc/mounts awk -v DCSDEV=$DCSDEVICE '{if ($1 == DCSDEV) { print $2 }}')"
+      DCSDIR="$(< /proc/mounts awk -v DCSDEV=$DCSDEVICE '{if ($1 == DCSDEV) { print $2; exit }}')"
       if [ -n "$DCSDIR" ]; then
         ewarn "$DCSDEVICE already mounted on $DCSDIR"; eend 0
       else
@@ -1632,75 +1633,6 @@ config_swraid(){
 }
 # }}}
 
-# {{{ dmraid
-config_dmraid(){
-  [ -n "$INSTALLED" ] && return 0
-
-  if checkbootparam 'nodmraid' ; then
-    ewarn "Skipping dmraid code as requested on boot commandline." ; eend 0
-    return 0
-  fi
-
-  if ! [ -x /sbin/dmraid ] ; then
-    ewarn "dmraid not available, can not execute it." ; eend 1
-    return
-  fi
-
-  dmraid_wrapper() {
-    # usage: dmraid_wrapper <dmraid_option>
-    [ -n "$1" ] || return 1
-
-    IFSOLD=${IFS:-}
-    IFS=$'\n'
-    eindent
-
-    for line in $(dmraid $1 ; echo errcode:$?); do
-      case $line in
-        *'no block devices found'*)
-          einfo "No block devices found" ; eend 0
-          break
-          ;;
-        *'no raid disks'*)
-          einfo "No active dmraid devices found" ; eend 0
-          break
-          ;;
-        errcode:0)
-          eend 0;
-          ;;
-        errcode:1)
-          eend 1
-          ;;
-        *)
-          einfo "$line"
-          ;;
-      esac
-    done
-
-    eoutdent
-    IFS=$IFSOLD
-  }
-
-  if checkbootparam 'dmraid' ; then
-    local ACTION="$(getbootparam 'dmraid' 2>>$DEBUG)"
-    if [ "$ACTION" = "off" ] ; then
-      # Deactivates all active software RAID sets:
-      einfo "Deactivating present dmraid sets (as requested via dmraid=off):"
-      dmraid_wrapper -an
-    else
-      # Activate all software RAID sets discovered:
-      einfo "Activating present dmraid sets (as requested via dmraid):"
-      dmraid_wrapper -ay
-    fi
-
-    return
-  fi
-
-  # by default (no special bootoptions) discover all software RAID devices:
-  einfo "Searching for any present dmraid sets:"
-  dmraid_wrapper -r
-}
-# }}}
-
 # {{{ LVM (Logical Volumes)
 config_lvm(){
   [ -n "$INSTALLED" ] && return 0
@@ -1991,5 +1923,43 @@ fi
 }
 # }}}
 
+# {{{ Easteregg (for 20 years grml.org)
+display_easteregg() {
+  einfo "You found the birthday easter egg!" ; eend 0
+
+  if [[ -x /bin/toilet && -x /usr/games/lolcat ]] ; then
+    visualize() { printf "%s\n" "$*" | toilet | /usr/games/lolcat ; }
+  elif [[ -x /bin/toilet ]] ; then
+    visualize() { printf "%s\n" "$*" | toilet ; }
+  else
+    visualize() { printf "%s\n" "$*" ; }
+  fi
+
+  visualize "   \o/   "
+  visualize "20 years"
+  visualize "grml.org"
+}
+
+config_easteregg() {
+  checkbootparam 'noeasteregg' && return 0
+
+  zmodload zsh/datetime 2>/dev/null || return 0
+  zmodload zsh/mathfunc 2>/dev/null || return 0
+
+  local birthday=1694822400            # := 2023-09-16 -> TZ=UTC date -d "2023-09-16" +%s
+  local one_month=$[24*30*3600]
+  local pi=3.14159265358979323846
+  local magic=$(( one_month/(pi/2) ))  # normalization factor, used to map the [birthday;birthday+-one_month] range onto [0;+-pi/2]
+
+  if [[ $(( abs(birthday-EPOCHSECONDS) )) -le $one_month ]] ; then
+    if [[ $(( rand48() )) -le $(( cos((birthday-EPOCHSECONDS)/magic) )) ]] ; then
+      display_easteregg
+    fi
+  fi
+
+  return 0
+}
+# }}}
+
 ## END OF FILE #################################################################
 # vim:foldmethod=marker expandtab ai ft=zsh shiftwidth=2
index 67c0f87..2b9ae55 100644 (file)
@@ -1,3 +1,73 @@
+grml-autoconfig (0.22.0) grml-testing; urgency=medium
+
+  * [ce26c04] Drop support for dmraid
+
+ -- Michael Prokop <mika@grml.org>  Fri, 02 Feb 2024 16:49:33 +0100
+
+grml-autoconfig (0.21.2) grml-testing; urgency=medium
+
+  [ Csillag Tamas ]
+  * [deb3d70] if multiple mountpoints avail, pick the first one
+
+ -- Michael Prokop <mika@grml.org>  Wed, 04 Oct 2023 18:59:59 +0200
+
+grml-autoconfig (0.21.1) grml-testing; urgency=medium
+
+  * [4e06a5e] Improve easter egg for 20 years of grml.org.
+    Thanks to Christopher Bock and András Korn
+
+ -- Michael Prokop <mika@grml.org>  Sat, 16 Sep 2023 14:44:00 +0200
+
+grml-autoconfig (0.21.0) grml-testing; urgency=medium
+
+  * [6015780] Implement easter egg for 20 years of grml.org.
+    Thanks to Christopher Bock for suggesting usage of lolcat
+
+ -- Michael Prokop <mika@grml.org>  Thu, 14 Sep 2023 18:24:38 +0200
+
+grml-autoconfig (0.20.7) grml-testing; urgency=medium
+
+  * [74eef77] config_cpu: use lscpu for identifying CPU information.
+    Thanks to Christopher Bock and András Korn for feedback
+
+ -- Michael Prokop <mika@grml.org>  Fri, 08 Sep 2023 08:55:38 +0200
+
+grml-autoconfig (0.20.6) grml-testing; urgency=medium
+
+  * [b39d89f] Replace deprecated vmware-detect with virt-what/imvirt.
+    Thanks to Christoph Biedl and András Korn for feedback
+  * [82176e8] imvirt/vmware: don't allow output of grep on stdout.
+    Thanks to András Korn
+
+ -- Michael Prokop <mika@grml.org>  Wed, 06 Sep 2023 17:25:03 +0200
+
+grml-autoconfig (0.20.5) grml-testing; urgency=medium
+
+  * [39d6dbd] Depend on util-linux-extra or older util-linux
+
+ -- Michael Prokop <mika@grml.org>  Fri, 11 Aug 2023 19:39:42 +0200
+
+grml-autoconfig (0.20.4) grml-testing; urgency=medium
+
+  * [7bfc241] Drop support for bootlogd. Thanks to Roland Sommer for
+    reporting
+
+ -- Michael Prokop <mika@grml.org>  Mon, 27 Feb 2023 17:37:07 +0100
+
+grml-autoconfig (0.20.3) grml-testing; urgency=medium
+
+  * [1e268ff] systemd unit: use StandardInput=null to work in serial
+    console mode
+
+ -- Michael Prokop <mika@grml.org>  Fri, 02 Sep 2022 17:16:56 +0200
+
+grml-autoconfig (0.20.2) grml-testing; urgency=medium
+
+  * [a08b349] running_under_secureboot: update for efivarfs + new mokutil
+    behavior
+
+ -- Michael Prokop <mika@grml.org>  Mon, 21 Mar 2022 18:02:52 +0100
+
 grml-autoconfig (0.20.1) grml-testing; urgency=medium
 
   * [59c0504] Demote unavailability of dmraid from error to warning only
index dff1c04..2230934 100644 (file)
@@ -31,6 +31,7 @@ Depends:
  rsync,
  rsyslog | system-log-daemon,
  udev,
+ util-linux-extra | util-linux (<= 2.38-1),
  zsh,
  ${misc:Depends},
  ${shlibs:Depends},
index 6e71b4d..dedb9a8 100755 (executable)
@@ -83,8 +83,6 @@ checkvalue $CONFIG_TIMEZONE && config_timezone
 
 checkvalue $CONFIG_SWRAID && config_swraid
 
-checkvalue $CONFIG_DMRAID && config_dmraid
-
 checkvalue $CONFIG_LVM && config_lvm
 
 checkvalue $CONFIG_TESTCD && config_testcd
@@ -146,6 +144,8 @@ checkvalue $CONFIG_BLANKING && config_blanking
 checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
 
 checkvalue $CONFIG_XSTARTUP && config_x_startup
+
+checkvalue $CONFIG_EASTEREGG && config_easteregg
 # }}}
 
 # {{{ Re-enable signals
index c2a1c99..c026713 100644 (file)
@@ -8,7 +8,7 @@ After=rc-local.service
 [Service]
 ExecStart=/etc/init.d/grml-autoconfig
 Type=oneshot
-StandardInput=tty
+StandardInput=null
 StandardOutput=tty
 
 [Install]