static usb ethnet addresses
[automated-distro-installer] / mymk-basefile
1 #!/bin/bash
2 # This file is part of Ian Kelling's automated-distro-installer
3 # Copyright (C) 2024 Ian Kelling
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
20 script_dir="${x%/*}"
21
22 usage() {
23 cat <<EOF
24 Usage: ${0##*/} [-h|--help] [mk-basefile_args]
25 Wrap fai's mk-basefile so output dir is $BASEFILE_DIR if it exists.
26
27 And fix things for trisquel. mk-basefile has a trisquel mirror added.
28
29 fai-project maintains ubuntu and debian basefiles, but it doesn't update
30 them often. Better to build our all our own.
31
32
33 Args I've used before:
34
35 -z BOOKWORM64
36 -z BULLSEYE64
37 -z BUSTER64
38 -z STRETCH64
39 -z XENIAL64
40
41 -z ARAMO64
42 -z NABIA64
43 -z ETIONA64
44 -z FLIDAS64
45 -z BELENOS64
46
47 -h|--help Print help and exit.
48
49 Note: Uses GNU getopt options parsing style.
50
51 Usage of mk-basefile:
52
53 EOF
54 $script_dir/fai/config/basefiles/mk-basefile -h
55 exit $1
56 }
57
58 case $1 in
59 -h|--help)
60 usage
61 ;;
62 esac
63
64 if [[ $EUID != 0 ]]; then
65 s=sudo
66 fi
67
68 cd /usr/share/debootstrap/scripts
69 for d in belenos flidas; do
70 if [[ ! -L $d && ! -e $d ]]; then
71 $s ln -sf gutsy $d;
72 fi
73 done
74 d=etiona
75 if [[ ! -L $d && ! -e $d ]]; then
76 $s ln -sf trisquel etiona;
77 fi
78
79 if [[ $BASEFILE_DIR ]]; then
80 cd $BASEFILE_DIR
81 fi
82
83 if awk '$2 == "/tmp" && $4 ~ /nodev/' /proc/mounts | grep -q . || [[ $? == 141 ]]; then
84 $s mount -o remount,dev /tmp
85 fi
86 $s $script_dir/fai/config/basefiles/mk-basefile "$@"