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