Unify both build scripts, use flags as options

main
axtloss 2 years ago
parent 806269b33e
commit d228cd713e

1
.gitignore vendored

@ -1,4 +1,5 @@
*.iso
*.tar.gz
crystal/airootfs/etc/pacman.conf
crystal/airootfs/etc/buildstamp
chrooted.sh

@ -0,0 +1,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

@ -1,21 +0,0 @@
#!/usr/bin/env bash
rm -fv *.iso
cp crystal/pacman.conf crystal/airootfs/etc/.
cp chrooted-iso.sh chrooted.sh
if [[ "$1" == "" ]]; then
WORKDIR=$(mktemp -d)
else
WORKDIR="$1"
if [[ ! -d "$WORKDIR" ]]; then
mkdir -p "$WORKDIR"
fi
fi
echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp
time sudo ./mkarchiso -v -w $WORKDIR -o . crystal
sudo rm -rf $WORKDIR
sudo chown $USER:$USER *.iso

@ -1,21 +0,0 @@
#!/usr/bin/env bash
rm -fv *.tar.xz
cp crystal/pacman.conf crystal/airootfs/etc/.
cp chrooted-bootstrap.sh chrooted.sh
if [[ "$1" == "" ]]; then
WORKDIR=$(mktemp -d)
else
WORKDIR="$1"
if [[ ! -d "$WORKDIR" ]]; then
mkdir -p "$WORKDIR"
fi
fi
echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp
time sudo ./mkarchiso -m bootstrap -v -w $WORKDIR -o . crystal
sudo rm -rf $WORKDIR
sudo chown $USER:$USER *.iso
Loading…
Cancel
Save