6 for i
in @path@
; do PATH
=$PATH:$i/bin
; done
9 echo "Usage: init-script-builder.sh DEFAULT-CONFIG"
16 [ "$(stat -f -c '%i' /)" = "$(stat -f -c '%i' /boot)" ] ||
{
17 # see grub-menu-builder.sh
18 echo "WARNING: /boot being on a different filesystem not supported by init-script-builder.sh"
24 targetOther
="/boot/init-other-configurations-contents.txt"
27 tmpOther
="$targetOther.tmp"
30 configurationCounter
=0
31 numAlienEntries
=`cat <<EOF | egrep '^[[:space:]]*title' | wc -l
38 # Add an entry to $targetOther
42 local shortSuffix
="$3"
44 configurationCounter
=$
((configurationCounter
+ 1))
46 local stage2
=$path/init
51 echo "# created by init-script-builder.sh"
55 [ "$path" != "$defaultConfig" ] || {
56 echo "$content" > $tmp
57 echo "# older configurations: $targetOther" >> $tmp
61 echo -e "$content\n\n" >> $tmpOther
67 addEntry
"@distroName@ - Default" $defaultConfig ""
69 # Add all generations of the system profile to the menu, in reverse
70 # (most recent to least recent) order.
71 for link
in $
((ls -d $defaultConfig/specialisation
/* ) |
sort -n); do
72 date=$
(stat
--printf="%y\n" $link |
sed 's/\..*//')
73 addEntry
"@distroName@ - variation" $link ""
77 (cd /nix
/var
/nix
/profiles
&& ls -d system-
*-link) \
78 |
sed 's/system-\([0-9]\+\)-link/\1/' \
80 link
=/nix
/var
/nix
/profiles
/system-
$generation-link
81 date=$
(stat
--printf="%y\n" $link |
sed 's/\..*//')
82 if [ -d $link/kernel
]; then
83 kernelVersion
=$
(cd $
(dirname $
(readlink
-f $link/kernel
))/lib
/modules
&& echo *)
84 suffix
="($date - $kernelVersion)"
88 addEntry
"@distroName@ - Configuration $generation $suffix" $link "$generation ($date)"
91 mv $tmpOther $targetOther