summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-03-03 11:01:37 +0100
committerJonas Smedegaard <dr@jones.dk>2014-03-03 11:01:37 +0100
commit8946c6ad43d5a36cf08d94e7f202c5d910a69211 (patch)
tree5a2a343e95b69f9dc20c9c32827affce0c75a8bc
parent7dc24d5c4a76c444972f66e844d7faa7132dda22 (diff)
Separate tweaks from skeleton file. Fix syntax of tweak functions (code inside {} must end with ; ).
-rw-r--r--Makefile7
-rwxr-xr-xbin/pkglist2preseed24
-rw-r--r--skel/preseed.cfg.in22
-rw-r--r--tweaks/base19
-rw-r--r--tweaks/desktop14
5 files changed, 56 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 813f019..9bb6e84 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
profiles = desktop
desktoptopics = email office web
desktoptopiclists = $(patsubst %,profiles/desktop-%,$(desktoptopics))
+desktoptweaks = tweaks/base tweaks/desktop
basefiles = $(patsubst %,content/%/base/preseed.cfg,$(profiles))
topicfiles = $(patsubst %,content/desktop/%/preseed.cfg,$(desktoptopics))
mainfiles = $(patsubst %,content/%/preseed.cfg,$(profiles))
@@ -14,13 +15,13 @@ all: $(checksumfiles)
sign: $(signfiles)
$(basefiles): content/%/base/preseed.cfg : profiles/% profiles/%-z
- bin/pkglist2preseed skel/preseed.cfg.in $@ $^
+ bin/pkglist2preseed skel/preseed.cfg.in $@ "$^" "$(desktoptweaks)"
$(topicfiles): content/desktop/%/preseed.cfg : profiles/desktop profiles/desktop-% profiles/desktop-z
- bin/pkglist2preseed skel/preseed.cfg.in $@ $^
+ bin/pkglist2preseed skel/preseed.cfg.in $@ "$^" "$(desktoptweaks)"
$(mainfiles): content/%/preseed.cfg : profiles/% profiles/%-email $(desktoptopiclists) profiles/%-z
- bin/pkglist2preseed skel/preseed.cfg.in $@ $^
+ bin/pkglist2preseed skel/preseed.cfg.in $@ "$^" "$(desktoptweaks)"
$(mdfiles): content/MD%SUMS: $(allfiles)
cd content && md$*sum $(allfiles:content/%=%) > MD$*SUMS~
diff --git a/bin/pkglist2preseed b/bin/pkglist2preseed
index 0e78b56..b9d5304 100755
--- a/bin/pkglist2preseed
+++ b/bin/pkglist2preseed
@@ -2,15 +2,25 @@
set -eu
-infile="$1"; shift
-outfile="$1"; shift
-# remaining arguments are packagelist files
+infile="$1"
+outfile="$2"
+pkgfiles="$3"
+tweakfiles="$4"
-pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' "$@") #'
-pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' "$@")
+pkgdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' $pkgfiles) #'
+pkglist=$(perl -ne 'chomp; /^[^#]+/ and print "$_ "' $pkgfiles)
-export pkgdesc pkglist
+tweakdesc=$(perl -nE '/^[#]{2} (.*)/ and say "# $1"; /^[#]{1} (.*)/ and say "# * $1"' $tweakfiles) #'
+tweaklist=$(perl -ne 'chomp; /^(?!#)\s*(.+)/ and print "$1;"' $tweakfiles)
+
+export pkgdesc pkglist tweakdesc tweaklist
mkdir -p $(dirname $outfile)
-perl -pe 's,__PKGDESC__,$ENV{"pkgdesc"},;s,__PKGLIST__,$ENV{"pkglist"},' < $infile > $outfile~
+perl -p \
+ -e 's,__PKGDESC__,$ENV{"pkgdesc"},;'\
+ -e 's,__PKGLIST__,$ENV{"pkglist"},;'\
+ -e 's,__TWEAKDESC__,$ENV{"tweakdesc"},;'\
+ -e 's,__TWEAKLIST__,$ENV{"tweaklist"},;'\
+ < $infile \
+ > $outfile~
mv -f $outfile~ $outfile
diff --git a/skel/preseed.cfg.in b/skel/preseed.cfg.in
index c9d077c..3f49904 100644
--- a/skel/preseed.cfg.in
+++ b/skel/preseed.cfg.in
@@ -40,23 +40,5 @@ popularity-contest popularity-contest/participate boolean true
# enable unattended-upgrades
unattended-upgrades unattended-upgrades/enable_auto_updates boolean true
-# tidy loose ends...
-# * fix mark auto-installed packages as such
-# * for any file edited or created, preserve a backup with suffix .orig
-# * auto-repair inconsistent filesystems during boot
-# * sleep when lid is closed, and modernize logic of radio on/off button
-# * silence confusing panel question at initial XFCE login
-# * replace appfinder with mail-reader in default XFCE panel
-# * disable storing Xfce session at logout by default
-#set -e
-#chroot /target apt-mark auto $(chroot /target apt-mark showmanual | grep '^lib') acpi acpi-support-base acpid adduser apt apt-utils aptitude-common base-files base-passwd bash bash-completion bsdmainutils bsdutils busybox coreutils cpio cron dash debconf debconf-i18n debian-archive-keyring debianutils diffutils dmidecode dpkg e2fslibs e2fsprogs findutils fonts-freefont-ttf gcc-4.7-base gnupg gpgv grep groff-base grub-common gzip hostname ifupdown initramfs-tools initscripts insserv install-info iproute isc-dhcp-client isc-dhcp-common keyboard-configuration kmod laptop-detect linux-image-amd64 locales login logrotate lsb-base mawk mount multiarch-support ncurses-base ncurses-bin net-tools netbase netcat-traditional passwd pciutils perl-base procps readline-common rsyslog sed sensible-utils sysv-rc sysvinit sysvinit-utils tar tasksel tasksel-data tzdata udev usbutils util-linux uuid-runtime vim-common xz-utils zlib1g
-#_backup() { set -e; [ -e "$1.orig" ] || if [ -e "$1" ]; then cp -a "$1" "$1.orig"; else touch "$1.orig"; fi }
-#_clone() { set -e; _backup "$2"; cp -a "$1" "$2" }
-#_setvar() { set -e; _backup "$1"; sed -i -r -e "s,^#?($2)=.*,\\1=$3," "$1" }
-#_setvar /target/etc/default/rcS FSCKFIX yes
-#_setvar /target/etc/default/acpi-support LID_SLEEP true
-#_setvar /target/etc/default/acpi-support WIRELESS_BLUETOOTH_SYNC true
-#cd /target/etc/xdg/xfce4/xfconf/xfce-perchannel-xml
-#_clone ../../panel/default.xml xfce4-panel.xml; sed -i -r -e 's,xfce4-appfinder,exo-mail-reader,' xfce4-panel.xml
-#_backup xfce4-session.xml; sed -i -r -e 's,(<property name="general"[^>]*>),\1\n <property name="SaveOnExit" type="bool" value="false"/>,' xfce4-session.xml
-d-i preseed/late_command string set -e;chroot /target apt-mark auto $(chroot /target apt-mark showmanual | grep '^lib') acpi acpi-support-base acpid adduser apt apt-utils aptitude-common base-files base-passwd bash bash-completion bsdmainutils bsdutils busybox coreutils cpio cron dash debconf debconf-i18n debian-archive-keyring debianutils diffutils dmidecode dpkg e2fslibs e2fsprogs findutils fonts-freefont-ttf gcc-4.7-base gnupg gpgv grep groff-base grub-common gzip hostname ifupdown initramfs-tools initscripts insserv install-info iproute isc-dhcp-client isc-dhcp-common keyboard-configuration kmod laptop-detect linux-image-amd64 locales login logrotate lsb-base mawk mount multiarch-support ncurses-base ncurses-bin net-tools netbase netcat-traditional passwd pciutils perl-base procps readline-common rsyslog sed sensible-utils sysv-rc sysvinit sysvinit-utils tar tasksel tasksel-data tzdata udev usbutils util-linux uuid-runtime vim-common xz-utils zlib1g;_orig() { set -e; [ -e "$1.orig" ] || if [ -e "$1" ]; then cp -a "$1" "$1.orig"; else touch "$1.orig"; fi };_clone() { set -e; _orig "$2"; cp -a "$1" "$2" };cd /target/etc/xdg/xfce4/xfconf/xfce-perchannel-xml;_clone ../../panel/default.xml xfce4-panel.xml; sed -i -r -e 's,xfce4-appfinder,exo-mail-reader,' xfce4-panel.xml;_orig xfce4-session.xml; sed -i -r -e 's,(<property name="general"[^>]*>),\1\n <property name="SaveOnExit" type="bool" value="false"/>,' xfce4-session.xml
+__TWEAKDESC__
+d-i preseed/late_command string __TWEAKLIST__
diff --git a/tweaks/base b/tweaks/base
new file mode 100644
index 0000000..e12a8cc
--- /dev/null
+++ b/tweaks/base
@@ -0,0 +1,19 @@
+## tidy loose ends...
+set -e
+# fix mark auto-installed packages as such
+chroot /target apt-mark auto $(chroot /target apt-mark showmanual | grep '^lib') acpi acpi-support-base acpid adduser apt apt-utils aptitude-common base-files base-passwd bash bash-completion bsdmainutils bsdutils busybox coreutils cpio cron dash debconf debconf-i18n debian-archive-keyring debianutils diffutils dmidecode dpkg e2fslibs e2fsprogs findutils fonts-freefont-ttf gcc-4.7-base gnupg gpgv grep groff-base grub-common gzip hostname ifupdown initramfs-tools initscripts insserv install-info iproute isc-dhcp-client isc-dhcp-common keyboard-configuration kmod laptop-detect linux-image-amd64 locales login logrotate lsb-base mawk mount multiarch-support ncurses-base ncurses-bin net-tools netbase netcat-traditional passwd pciutils perl-base procps readline-common rsyslog sed sensible-utils sysv-rc sysvinit sysvinit-utils tar tasksel tasksel-data tzdata udev usbutils util-linux uuid-runtime vim-common xz-utils zlib1g
+# keep backup of any tweaked (i.e. edited or created) config file
+_backup(){ set -e
+ [ -e "$1.orig" ] || if [ -e "$1" ]; then cp -a "$1" "$1.orig"
+ else touch "$1.orig"
+ fi; }
+_clone(){ set -e
+ _backup "$2"
+ cp -a "$1" "$2"; }
+_setvar(){ set -e
+ _backup "$1"
+ sed -i -r -e "s,^#?($2)=.*,\\1=$3," "$1"; }
+
+## non-technical operation
+# auto-repair inconsistent filesystems during boot
+_setvar /target/etc/default/rcS FSCKFIX yes
diff --git a/tweaks/desktop b/tweaks/desktop
new file mode 100644
index 0000000..877eb13
--- /dev/null
+++ b/tweaks/desktop
@@ -0,0 +1,14 @@
+## power management
+# sleep when lid is closed, and modernize logic of radio on/off button
+_setvar /target/etc/default/acpi-support LID_SLEEP true
+_setvar /target/etc/default/acpi-support WIRELESS_BLUETOOTH_SYNC true
+
+## Xfce
+cd /target/etc/xdg/xfce4/xfconf/xfce-perchannel-xml
+# silence confusing panel question at initial login
+_clone ../../panel/default.xml xfce4-panel.xml
+# replace appfinder with mail-reader in default panel
+sed -i -r -e 's,xfce4-appfinder,exo-mail-reader,' xfce4-panel.xml
+# disable storing session at logout by default
+_backup xfce4-session.xml
+sed -i -r -e 's,(<property name="general"[^>]*>),\1\n <property name="SaveOnExit" type="bool" value="false"/>,' xfce4-session.xml