File: hook-directory

package info (click to toggle)
mmdebstrap 1.5.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,724 kB
  • sloc: perl: 6,092; sh: 4,497; python: 1,269; makefile: 22
file content (49 lines) | stat: -rw-r--r-- 2,161 bytes parent folder | download | duplicates (3)
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
47
48
49
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
for h in hookA hookB; do
  mkdir /tmp/$h
  for s in setup extract essential customize; do
    cat <<SCRIPT >/tmp/$h/${s}00.sh
#!/bin/sh
echo $h/${s}00 >> "\$1/$s"
SCRIPT
    chmod +x /tmp/$h/${s}00.sh
    cat <<SCRIPT >/tmp/$h/${s}01.sh
echo $h/${s}01 >> "\$1/$s"
SCRIPT
    chmod +x /tmp/$h/${s}01.sh
  done
done
{{ CMD }} --mode=root --variant=apt \
  --setup-hook='echo cliA/setup >> "$1"/setup' \
  --extract-hook='echo cliA/extract >> "$1"/extract' \
  --essential-hook='echo cliA/essential >> "$1"/essential' \
  --customize-hook='echo cliA/customize >> "$1"/customize' \
  --hook-dir=/tmp/hookA \
  --setup-hook='echo cliB/setup >> "$1"/setup' \
  --extract-hook='echo cliB/extract >> "$1"/extract' \
  --essential-hook='echo cliB/essential >> "$1"/essential' \
  --customize-hook='echo cliB/customize >> "$1"/customize' \
  --hook-dir=/tmp/hookB \
  --setup-hook='echo cliC/setup >> "$1"/setup' \
  --extract-hook='echo cliC/extract >> "$1"/extract' \
  --essential-hook='echo cliC/essential >> "$1"/essential' \
  --customize-hook='echo cliC/customize >> "$1"/customize' \
  {{ DIST }} /tmp/debian-chroot {{ MIRROR }}
printf "cliA/setup\nhookA/setup00\nhookA/setup01\ncliB/setup\nhookB/setup00\nhookB/setup01\ncliC/setup\n" | diff -u - /tmp/debian-chroot/setup
printf "cliA/extract\nhookA/extract00\nhookA/extract01\ncliB/extract\nhookB/extract00\nhookB/extract01\ncliC/extract\n" | diff -u - /tmp/debian-chroot/extract
printf "cliA/essential\nhookA/essential00\nhookA/essential01\ncliB/essential\nhookB/essential00\nhookB/essential01\ncliC/essential\n" | diff -u - /tmp/debian-chroot/essential
printf "cliA/customize\nhookA/customize00\nhookA/customize01\ncliB/customize\nhookB/customize00\nhookB/customize01\ncliC/customize\n" | diff -u - /tmp/debian-chroot/customize
for s in setup extract essential customize; do
  rm /tmp/debian-chroot/$s
done
tar -C /tmp/debian-chroot --one-file-system -c . | tar -t | sort | diff -u tar1.txt -
for h in hookA hookB; do
  for s in setup extract essential customize; do
    rm /tmp/$h/${s}00.sh
    rm /tmp/$h/${s}01.sh
  done
  rmdir /tmp/$h
done
rm -r /tmp/debian-chroot