minor fixes, dns, new os versions
[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 BUSTER64
20 -z STRETCH64
21 -z XENIAL64
22 -z NABIA64
23 -z ETIONA64
24 -z FLIDAS64
25 -z BELENOS64
26
27 -h|--help Print help and exit.
28
29 Note: Uses GNU getopt options parsing style.
30
31 Usage of mk-basefile:
32
33 EOF
34 $script_dir/fai/config/basefiles/mk-basefile -h
35 exit $1
36 }
37
38 case $1 in
39 -h|--help)
40 usage
41 ;;
42 esac
43
44 if [[ $EUID != 0 ]]; then
45 s=sudo
46 fi
47
48 cd /usr/share/debootstrap/scripts
49 for d in belenos flidas; do
50 if [[ ! -L $d && ! -e $d ]]; then
51 $s ln -sf gutsy $d;
52 fi
53 done
54 d=etiona
55 if [[ ! -L $d && ! -e $d ]]; then
56 $s ln -sf trisquel etiona;
57 fi
58
59 if [[ $BASEFILE_DIR ]]; then
60 cd $BASEFILE_DIR
61 fi
62
63 if awk '$2 == "/tmp" && $4 ~ /nodev/' /proc/mounts | grep -q . || [[ $? == 141 ]]; then
64 $s mount -o remount,dev /tmp
65 fi
66 $s $script_dir/fai/config/basefiles/mk-basefile "$@"