2 # Copyright (C) 2018 Ian Kelling
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
21 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
23 this_file
="$(readlink -f -- "${BASH_SOURCE[0]}")"
24 readonly this_file this_dir
="${this_file%/*}"
25 PATH
="$this_dir:$PATH" # directory of this file
29 Usage: ${0##*/} DISTRO_CODENAME
30 Make basefile with desktop packages preinstalled
32 The longest amount of time when doing a new install is installing
33 packages. We can make that faster by preinstalling them in a
34 basefile. When a basefile is created, debootstrap allows you to
35 specify extra packages, but in trisquel, most packages don't install
36 that way. Not sure exactly why. So, we can do a fai dirinstall (fancy
37 chroot) to install packages, then turn that into a new basefile.
39 The script depnds on being in a directory with other scripts from it's repo.
41 Warning: uses paths specific to author's machine.
43 -h|--help Print help and exit.
45 Note: Uses GNU getopt options parsing style
50 read -r distver
<<<"$@"
52 if [[ $# != 1 ]]; then
53 echo "$0: error: expected one argument"
61 classes
="UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS DESKTOP"
64 classes
="DEBIAN STRETCH64 VOL_STRETCH STRETCH DESKTOP"
67 echo "$0: error: unknown DISTRO_CODENAME"
74 # background: i tried using a tmpfs for this. it had minimal effect, like 17 mins vs 18 mins
79 sed -i 's/^#LOGUSER=/LOGUSER=/' /etc
/fai
/fai.conf
80 for d
in proc var
/lib
/dpkg var
/cache
; do
88 sed -i 's/^LOGUSER=/#LOGUSER=/' /etc
/fai
/fai.conf
89 # config umount required after a failed run, proc umount always required
90 umount
/var
/lib
/fai
/config ||
: ; umount
-R $t/proc ||
:
92 fai-redep faiserver.b8.nz
$distro
93 echo "echo $classes" > /srv
/fai
/config
/class
/51-multi-boot
95 rm -rf $t; mkdir
-p $t
97 # shellcheck disable=SC1007 # intentional
98 LANG
= fai
-N -u hostname_does_not_matter dirinstall
$t
100 # Turn a dirinstall into a basefile. taken from mk-basefile
101 chroot
$t apt-get clean
102 rm -f $t/etc
/hostname
$t/etc
/resolv.conf \
103 $t/var
/lib
/apt
/lists
/*_
* $t/usr
/bin
/qemu-
*-static \
104 $t/etc
/udev
/rules.d
/70-persistent-net.rules
105 echo |
dd of
=$t/etc
/machine-id
106 tar --one-file-system -C $t -cf - . | zstd
-9 > /a
/bin
/fai-basefiles
/basefiles
/${distver^^}64BIG.
tar.zst