a bunch of fixes and improvements
[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 ETIONA64
23 -z FLIDAS64
24 -z BELENOS64
25
26 -h|--help Print help and exit.
27
28 Note: Uses GNU getopt options parsing style.
29
30 Usage of mk-basefile:
31
32 EOF
33 $script_dir/fai/config/basefiles/mk-basefile -h
34 exit $1
35 }
36
37 case $1 in
38 -h|--help)
39 usage
40 ;;
41 esac
42
43 if [[ $EUID != 0 ]]; then
44 s=sudo
45 fi
46
47 cd /usr/share/debootstrap/scripts
48 for d in belenos flidas; do
49 if [[ ! -L $d && ! -e $d ]]; then
50 $s ln -sf gutsy $d;
51 fi
52 done
53 d=etiona
54 if [[ ! -L $d && ! -e $d ]]; then
55 $s ln -sf trisquel etiona;
56 fi
57
58 if [[ $BASEFILE_DIR ]]; then
59 cd $BASEFILE_DIR
60 fi
61
62 $s $script_dir/fai/config/basefiles/mk-basefile "$@"