This is a no-op preparatory commit, intended to make it easier to review
future commits. f-k-i.postinst becomes f-k-i.postinst.in, which is now used
to "generate" the former using cat as a placeholder.
---
 debian/flash-kernel-installer.postinst    | 114 ------------------------------
 debian/flash-kernel-installer.postinst.in | 114 ++++++++++++++++++++++++++++++
 debian/rules                              |  13 ++++
 3 files changed, 127 insertions(+), 114 deletions(-)
 delete mode 100755 debian/flash-kernel-installer.postinst
 create mode 100755 debian/flash-kernel-installer.postinst.in

diff --git a/debian/flash-kernel-installer.postinst 
b/debian/flash-kernel-installer.postinst
deleted file mode 100755
index 9017ac3..0000000
--- a/debian/flash-kernel-installer.postinst
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-# This code is covered by the GNU General Public License (GPLv2 or higher)
-
-set -e
-
-FK_DIR="/usr/share/flash-kernel"
-
-. "${FK_CHECKOUT:-$FK_DIR}/functions"
-
-. /usr/share/debconf/confmodule
-
-log() {
-       logger -t flash-kernel-installer "$@"
-}
-
-error() {
-       log "error: $@"
-       db_progress STOP
-       exit 1
-}
-
-findfs () {
-       mount | grep "on /target${1%/} " | tail -n1 | cut -d' ' -f1
-}
-
-get_machine
-
-if machine_uses_flash "$machine"; then
-       db_progress START 0 3 flash-kernel-installer/progress
-else
-       db_progress START 0 3 flash-kernel-installer/progress_disk
-fi
-db_progress INFO flash-kernel-installer/prepare
-
-# Stop fsck from prompting the user for input since most users don't
-# have a serial console.
-if [ -e /target/etc/default/rcS ]; then
-       sed -i -e "s/^FSCKFIX=no$/FSCKFIX=yes/" /target/etc/default/rcS || true
-fi
-if [ -e /target/etc/default/fsck ]; then
-       sed -i -e "s/^#FSCKFIX=no$/FSCKFIX=yes/" -e 
"s/^FSCKFIX=no$/FSCKFIX=yes/" /target/etc/default/fsck || true
-fi
-
-if ! apt-install flash-kernel; then
-       error "apt-install flash-kernel failed"
-fi
-
-# Temporarily move flash-kernel out of the way so update-initramfs
-# won't call flash-kernel; otherwise we might call it twice.
-mv /target/usr/sbin/flash-kernel /target/tmp/flash-kernel.$$
-trap "mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel" EXIT HUP 
INT QUIT TERM
-
-db_progress STEP 1
-
-for package in $(get_machine_field "$machine" "Optional-Packages"); do
-       if ! apt-install "$package"; then
-               log "apt-install $package failed"
-       fi
-done
-for package in $(get_machine_field "$machine" "Required-Packages"); do
-       if ! apt-install "$package"; then
-               error "apt-install $package failed"
-       fi
-done
-
-case "$machine" in
-       "Linksys NSLU2")
-               # installing nslu2-utils will call update-initramfs -u
-               :
-       ;;
-       *)
-               in-target update-initramfs -u || true
-       ;;
-esac
-
-if [ "$machine" = "HP Media Vault mv2120" ]; then
-       # The firmware loads /boot/uImage from the first partition
-       # but uImage will be in / if a separate boot partition is
-       # used.  In this case, create a /boot/boot -> /boot symlink.
-       # Note that a partman check will make sure that /boot (if
-       # it exists) or / (if there's no separate /boot) are on the
-       # first partition.
-       rootfs=$(findfs /)
-       bootfs=$(findfs /boot)
-       if [ "$rootfs" != "$bootfs" ]; then
-               if [ ! -e /target/boot/boot ]; then
-                       ln -s . /target/boot/boot
-               fi
-       fi
-fi
-
-db_progress STEP 1
-if machine_uses_flash "$machine"; then
-       db_progress INFO flash-kernel-installer/flashing
-else
-       db_progress INFO flash-kernel-installer/generating_image
-fi
-
-trap - EXIT HUP INT QUIT TERM
-mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel
-
-# We need the udev /dev which has the MTD devices
-mount -o bind /dev /target/dev
-if ! in-target flash-kernel; then
-       umount /target/dev || true
-       error "flash-kernel failed"
-fi
-umount /target/dev || true
-
-db_progress STEP 1
-db_progress STOP
-
-# vim:noexpandtab shiftwidth=8
diff --git a/debian/flash-kernel-installer.postinst.in 
b/debian/flash-kernel-installer.postinst.in
new file mode 100755
index 0000000..9017ac3
--- /dev/null
+++ b/debian/flash-kernel-installer.postinst.in
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# This code is covered by the GNU General Public License (GPLv2 or higher)
+
+set -e
+
+FK_DIR="/usr/share/flash-kernel"
+
+. "${FK_CHECKOUT:-$FK_DIR}/functions"
+
+. /usr/share/debconf/confmodule
+
+log() {
+       logger -t flash-kernel-installer "$@"
+}
+
+error() {
+       log "error: $@"
+       db_progress STOP
+       exit 1
+}
+
+findfs () {
+       mount | grep "on /target${1%/} " | tail -n1 | cut -d' ' -f1
+}
+
+get_machine
+
+if machine_uses_flash "$machine"; then
+       db_progress START 0 3 flash-kernel-installer/progress
+else
+       db_progress START 0 3 flash-kernel-installer/progress_disk
+fi
+db_progress INFO flash-kernel-installer/prepare
+
+# Stop fsck from prompting the user for input since most users don't
+# have a serial console.
+if [ -e /target/etc/default/rcS ]; then
+       sed -i -e "s/^FSCKFIX=no$/FSCKFIX=yes/" /target/etc/default/rcS || true
+fi
+if [ -e /target/etc/default/fsck ]; then
+       sed -i -e "s/^#FSCKFIX=no$/FSCKFIX=yes/" -e 
"s/^FSCKFIX=no$/FSCKFIX=yes/" /target/etc/default/fsck || true
+fi
+
+if ! apt-install flash-kernel; then
+       error "apt-install flash-kernel failed"
+fi
+
+# Temporarily move flash-kernel out of the way so update-initramfs
+# won't call flash-kernel; otherwise we might call it twice.
+mv /target/usr/sbin/flash-kernel /target/tmp/flash-kernel.$$
+trap "mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel" EXIT HUP 
INT QUIT TERM
+
+db_progress STEP 1
+
+for package in $(get_machine_field "$machine" "Optional-Packages"); do
+       if ! apt-install "$package"; then
+               log "apt-install $package failed"
+       fi
+done
+for package in $(get_machine_field "$machine" "Required-Packages"); do
+       if ! apt-install "$package"; then
+               error "apt-install $package failed"
+       fi
+done
+
+case "$machine" in
+       "Linksys NSLU2")
+               # installing nslu2-utils will call update-initramfs -u
+               :
+       ;;
+       *)
+               in-target update-initramfs -u || true
+       ;;
+esac
+
+if [ "$machine" = "HP Media Vault mv2120" ]; then
+       # The firmware loads /boot/uImage from the first partition
+       # but uImage will be in / if a separate boot partition is
+       # used.  In this case, create a /boot/boot -> /boot symlink.
+       # Note that a partman check will make sure that /boot (if
+       # it exists) or / (if there's no separate /boot) are on the
+       # first partition.
+       rootfs=$(findfs /)
+       bootfs=$(findfs /boot)
+       if [ "$rootfs" != "$bootfs" ]; then
+               if [ ! -e /target/boot/boot ]; then
+                       ln -s . /target/boot/boot
+               fi
+       fi
+fi
+
+db_progress STEP 1
+if machine_uses_flash "$machine"; then
+       db_progress INFO flash-kernel-installer/flashing
+else
+       db_progress INFO flash-kernel-installer/generating_image
+fi
+
+trap - EXIT HUP INT QUIT TERM
+mv /target/tmp/flash-kernel.$$ /target/usr/sbin/flash-kernel
+
+# We need the udev /dev which has the MTD devices
+mount -o bind /dev /target/dev
+if ! in-target flash-kernel; then
+       umount /target/dev || true
+       error "flash-kernel failed"
+fi
+umount /target/dev || true
+
+db_progress STEP 1
+db_progress STOP
+
+# vim:noexpandtab shiftwidth=8
diff --git a/debian/rules b/debian/rules
index c9b4395..904ff03 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,18 @@
 #! /usr/bin/make -f
 
+AUTOGEN_DEB_FILES := flash-kernel-installer.postinst
+override_dh_auto_install:
+       for i in $(AUTOGEN_DEB_FILES); do \
+               cat < debian/$$i.in > debian/$$i; \
+       done
+       dh_auto_install
+
+override_dh_auto_clean:
+       for i in $(AUTOGEN_DEB_FILES); do \
+               rm -f debian/$$i; \
+       done
+       dh_auto_clean
+
 override_dh_auto_test:
        FK_CHECKOUT=. ./test_db
        FK_CHECKOUT=. ./test_flash-kernel
-- 
2.0.0


-- 
To UNSUBSCRIBE, email to debian-arm-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/1401414889-16498-2-git-send-email-da...@debian.org

Reply via email to