File: postinst

package info (click to toggle)
di-netboot-assistant 0.79
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 316 kB
  • sloc: sh: 1,511; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,626 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
set -eu

STATUS_LIB=/var/lib/di-netboot-assistant
TFTP_ROOT=/var/lib/tftpboot
N_A_DIR=d-i/n-a

if [ -e /etc/di-netboot-assistant/di-netboot-assistant.conf ] ; then
    . /etc/di-netboot-assistant/di-netboot-assistant.conf
fi

migrate_dir() {
    echo "Migrating setup to use $TFTP_ROOT/$N_A_DIR/ as di-netboot-assistant's directory."
    if [ -d "$TFTP_ROOT/debian-installer" ] && \
           grep -q di-netboot-assistant $TFTP_ROOT/debian-installer/README.txt > /dev/null 2>&1 ; then
        [ -d  "$TFTP_ROOT/$N_A_DIR" ] && mv "$TFTP_ROOT/$N_A_DIR" "$TFTP_ROOT/${N_A_DIR}_$(date +%Y%m%d%H%M%S)"
        mkdir -p $TFTP_ROOT/$N_A_DIR
        mv $TFTP_ROOT/debian-installer/* $TFTP_ROOT/$N_A_DIR && \
            rmdir --ignore-fail-on-non-empty $TFTP_ROOT/debian-installer
        find $TFTP_ROOT/$N_A_DIR -print0 -type f -a \( -name "default" -o -name "boot.txt" -o -name '*.cfg' \) \
            | xargs -r -n 1 sed -i -e "s#::/debian-installer/#::/$N_A_DIR/#g"
        sed -i -e "s# /debian-installer/# /$N_A_DIR/#g" $TFTP_ROOT/$N_A_DIR/grub/grub.cfg
    else
        echo "Directory $TFTP_ROOT/debian-installer not found or not managed by di-netboot-assistant."
    fi
    if [ -d "$STATUS_LIB" ]; then
	find $STATUS_LIB -print0 -type f | xargs -r -n 1 sed -i -e "s#debian-installer/#$N_A_DIR/#g"
    fi
}

case "$1" in
    configure|abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0