archbox/install.sh

67 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2020-12-28 05:22:53 +00:00
#!/usr/bin/env bash
2020-10-27 06:12:14 +00:00
2021-05-17 07:07:34 +00:00
genconfig(){
cat << EOF
ARCHBOX_USER="${ARCHBOX_USER:-root}"
PRIV="${PRIV:-sudo}"
INSTALL_PATH="${INSTALL_PATH:-/var/archlinux}"
CHROOT="${CHROOT:-\$INSTALL_PATH/root.x86_64}"
# Nix OS will breaks when you mount /run, change MOUNT_RUN to "no"
# if you use Nix OS, don't forget to use \`archbox --mount-runtime-only\`
# after user login.
MOUNT_RUN="${MOUNT_RUN:-yes}"
# Mount modules and boot directory, useful if you want to use kernels
# from Arch Linux repo, otherwise it's best to remain disabled.
MOUNT_MOD="${MOUNT_MOD:-no}"
# Lazy unmounting, make sure you know what you're doing if enabling this!
LAZY_UMOUNT="${LAZY_UMOUNT:-no}"
# Put your desired enviroment variable here, for example:
#
# ENV_VAR="HOME=/var/home/lemniskett"
#
ENV_VAR="${ENV_VAR:-}"
# Parse a Systemd service and executes it on boot, order matters, for example:
#
2021-05-28 08:17:42 +00:00
# SERVICES="vmware-networks-configuration vmware-networks vmware-usbarbitrator php-fpm:3 nginx"
2021-05-17 07:07:34 +00:00
#
# Keep in mind that this doesn't resolve service dependencies, so you may need to
# enable the dependencies manually.
2021-05-28 08:17:42 +00:00
SERVICES="${SERVICES:-}"
2021-05-17 07:07:34 +00:00
# Share other host directories into Archbox, absolute path needed.
2021-05-28 08:17:42 +00:00
SHARED_FOLDER="${SHARED_FOLDERS:-/home}"
2021-05-17 07:07:34 +00:00
EOF
}
2021-05-16 17:07:25 +00:00
ETC_DIR="${ETC_DIR:-/etc}"
PREFIX="${PREFIX:-/usr/local}"
2021-01-23 09:06:38 +00:00
mkdir -p $PREFIX/share/archbox/bin
2021-05-17 07:01:32 +00:00
mkdir -p $ETC_DIR
2021-05-18 11:54:49 +00:00
install -v -D -m 755 ./src/archbox $PREFIX/bin/archbox
2021-05-27 10:15:27 +00:00
install -v -D -m 755 ./src/archbox-desktop $PREFIX/bin/archbox-desktop
2021-05-17 07:07:34 +00:00
[[ ! -e /etc/archbox.conf || ! -z $FORCE_INSTALL_CONFIG ]] && genconfig > $ETC_DIR/archbox.conf
2021-05-27 10:27:10 +00:00
install -v -D -m 755 ./src/exec $PREFIX/share/archbox/bin/exec
install -v -D -m 755 ./src/enter $PREFIX/share/archbox/bin/enter
2021-05-27 10:25:30 +00:00
install -v -D -m 755 ./src/chroot_setup $PREFIX/share/archbox/chroot_setup
2021-05-27 11:02:13 +00:00
install -v -D -m 755 ./src/init $PREFIX/share/archbox/bin/init
2021-05-27 11:07:36 +00:00
install -v -D -m 755 ./src/uth $PREFIX/share/archbox/bin/uth
2021-01-23 09:06:38 +00:00
2021-05-16 17:07:25 +00:00
grep 'PREFIX=' $ETC_DIR/archbox.conf >/dev/null 2>&1 || cat << EOF >> $ETC_DIR/archbox.conf
2021-01-23 09:06:38 +00:00
# Don't change this unless you know what you're doing.
PREFIX="$PREFIX"
EOF
2020-11-03 15:45:26 +00:00
[[ -z $1 ]] && exit 0
2020-11-02 12:36:27 +00:00
if [ $1 = "--exp" ]; then
2021-05-16 16:16:30 +00:00
install -v -D -m 755 ./src/exp/startx-killxdg.bash $PREFIX/bin/startx-killxdg
2020-11-03 15:45:26 +00:00
else
echo "Unknown install option: $1"
2020-11-02 12:36:27 +00:00
fi