document upstream merge
[automated-distro-installer] / mymk-basefile
1 #!/bin/bash
2
3 x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
4 script_dir="${x%/*}"
5
6 usage() {
7 cat <<EOF
8 Usage: ${0##*/} [-h|--help] [mk-basefile_args]
9 Wrap fai's mk-basefile so output dir is $BASEFILE_DIR if it exists.
10
11 And fix things for trisquel. mk-basefile has a trisquel mirror added.
12
13 fai-project maintains ubuntu and debian basefiles, but it doesn't update
14 them often. Better to build our all our own.
15
16
17 Args I've used before:
18
19 -z BULLSEYE64
20 -z BUSTER64
21 -z STRETCH64
22 -z XENIAL64
23 -z NABIA64
24 -z ETIONA64
25 -z FLIDAS64
26 -z BELENOS64
27
28 -h|--help Print help and exit.
29
30 Note: Uses GNU getopt options parsing style.
31
32 Usage of mk-basefile:
33
34 EOF
35 $script_dir/fai/config/basefiles/mk-basefile -h
36 exit $1
37 }
38
39 case $1 in
40 -h|--help)
41 usage
42 ;;
43 esac
44
45 if [[ $EUID != 0 ]]; then
46 s=sudo
47 fi
48
49 cd /usr/share/debootstrap/scripts
50 for d in belenos flidas; do
51 if [[ ! -L $d && ! -e $d ]]; then
52 $s ln -sf gutsy $d;
53 fi
54 done
55 d=etiona
56 if [[ ! -L $d && ! -e $d ]]; then
57 $s ln -sf trisquel etiona;
58 fi
59
60 if [[ $BASEFILE_DIR ]]; then
61 cd $BASEFILE_DIR
62 fi
63
64 if awk '$2 == "/tmp" && $4 ~ /nodev/' /proc/mounts | grep -q . || [[ $? == 141 ]]; then
65 $s mount -o remount,dev /tmp
66 fi
67 $s $script_dir/fai/config/basefiles/mk-basefile "$@"