-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sh
executable file
·43 lines (40 loc) · 1.18 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
if [[ "$2" == "" ]]; then
WORKDIR=$(mktemp -d)
else
WORKDIR="$2"
if [[ ! -d "$WORKDIR" ]]; then
mkdir -p "$WORKDIR"
fi
fi
if [[ "$1" == "--build-iso" ]]; then
cp chrooted-iso.sh chrooted.sh
MKARCHISO_FLAGS="-v -w $WORKDIR -o . crystal"
rm -fv *.iso
elif [[ "$1" == "--build-bootstrap" ]]; then
cp chrooted-bootstrap.sh chrooted.sh
MKARCHISO_FLAGS="-m bootstrap -v -w $WORKDIR -o . crystal"
rm -fv *.tar.gz
else
RESULTCODE=0
if [[ "$1" == "" ]]; then
echo "no option given, available options are:"
RESULTCODE=1
elif [[ "$1" != "--help" ]]; then
echo "option '$1' not known, available options are:"
RESULTCODE=1
fi
echo "--build-iso builds a crystal linux iso"
echo "--build-bootstrap builds a crystal linux rootfs tarball"
echo "--help display this message"
exit $RESULTCODE
fi
cp crystal/pacman.conf crystal/airootfs/etc/.
echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp
time sudo ./mkarchiso $MKARCHISO_FLAGS
sudo rm -rf $WORKDIR
if [[ "$1" == "--build-iso" ]]; then
sudo chown $USER:$USER *.iso
else
sudo chown $USER:$USER *.tar.gz
fi