various fixes, make settable basefile dir
[automated-distro-installer] / mymk-basefile
diff --git a/mymk-basefile b/mymk-basefile
new file mode 100755 (executable)
index 0000000..2a7f453
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
+script_dir="${x%/*}"
+
+usage() {
+  cat <<EOF
+Usage: ${0##*/} [-h|--help] [mk-basefile_args]
+Wrap fai's mk-basefile so output dir is $BASEFILE_DIR if it exists.
+
+And fix things for trisquel. mk-basefile has a trisquel mirror added.
+
+fai-project maintains ubuntu and debian basefiles, but it doesn't update
+them often. Better to build our all our own.
+
+
+Args I've used before:
+
+-z STRETCH64
+-z XENIAL64
+-z FLIDAS64
+-z BELENOS64
+
+-h|--help  Print help and exit.
+
+Note: Uses GNU getopt options parsing style
+EOF
+  $script_dir/fai/config/basefiles/mk-basefile -h
+  exit $1
+}
+
+case $1 in
+  -h|--help)
+    usage
+    ;;
+esac
+
+if [[ $EUID != 0 ]]; then
+  s=sudo
+fi
+
+cd /usr/share/debootstrap/scripts
+for d in belenos flidas; do
+  if [[ ! -L $d && ! -e $d ]]; then
+    $s ln -sf gutsy $d;
+  fi
+done
+
+if [[ $BASEFILE_DIR ]]; then
+  cd $BASEFILE_DIR
+fi
+
+$s $script_dir/fai/config/basefiles/mk-basefile "$@"