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" "$@"
22 x
="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
23 x
="$(readlink -f -- "$BASH_SOURCE")"; PATH
="${x%/*}:$PATH" # directory of this file
27 Usage: ${0##*/} DISTRO_CODENAME
28 Make basefile with desktop packages preinstalled
30 The longest amount of time when doing a new install is installing
31 packages. We can make that faster by preinstalling them in a
32 basefile. When a basefile is created, debootstrap allows you to
33 specify extra packages, but in trisquel, most packages don't install
34 that way. Not sure exactly why. So, we can do a fai dirinstall (fancy
35 chroot) to install packages, then turn that into a new basefile.
37 The script depnds on being in a directory with other scripts from it's repo.
39 Warning: uses paths specific to author's machine.
41 -h|--help Print help and exit.
43 Note: Uses GNU getopt options parsing style
50 if [[ $# != 1 ]]; then
51 echo "$0: error: expected one argument"
59 classes
="UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS DESKTOP"
62 classes
="DEBIAN STRETCH64 VOL_STRETCH STRETCH DESKTOP"
65 echo "$0: error: unknown DISTRO_CODENAME"
72 # background: i tried using a tmpfs for this. it had minimal effect, like 17 mins vs 18 mins
77 sed -i 's/^#LOGUSER=/LOGUSER=/' /etc
/fai
/fai.conf
78 for d
in proc var
/lib
/dpkg var
/cache
; do
86 sed -i 's/^LOGUSER=/#LOGUSER=/' /etc
/fai
/fai.conf
87 # config umount required after a failed run, proc umount always required
88 umount
/var
/lib
/fai
/config ||
: ; umount
-R $t/proc ||
:
90 fai-redep faiserver
$distro
91 echo "echo $classes" > /srv
/fai
/config
/class
/51-multi-boot
93 rm -rf $t; mkdir
-p $t
95 LANG
= fai
-N -u hostname_does_not_matter dirinstall
$t
97 # Turn a dirinstall into a basefile. taken from mk-basefile
98 chroot
$t apt-get clean
99 rm -f $t/etc
/hostname
$t/etc
/resolv.conf \
100 $t/var
/lib
/apt
/lists
/*_
* $t/usr
/bin
/qemu-
*-static \
101 $t/etc
/udev
/rules.d
/70-persistent-net.rules
102 echo |
dd of
=$t/etc
/machine-id
103 tar --one-file-system -C $t -cf - . |
gzip > /a
/bin
/fai-basefiles
/basefiles
/${distver^^}64BIG.
tar.gz