diff --git a/README.md b/README.md index 310f0f7..b9c484e 100644 --- a/README.md +++ b/README.md @@ -86,14 +86,14 @@ This isn't actually using systemd to start services, rather it parses systemd .s ##### Autostart services To enable service on host boot, edit `/etc/archbox.conf` : ``` -SERVICES=( vmware-networks-configuration vmware-networks vmware-usbarbitrator nginx ) +SERVICES="vmware-networks-configuration vmware-networks vmware-usbarbitrator nginx" ``` Keep in mind that this doesn't resolve service dependencies, so you may need to enable the dependencies manually. you can use ```archboxctl desc ``` to read the .service file ##### Post-exec delay Services are asynchronously started, if some services have some issues when starting together you may want to add post-exec delay. ``` -SERVICES=( php-fpm:3 nginx ) +SERVICES="php-fpm:3 nginx" ``` This will add 3 seconds delay after executing php-fpm. @@ -163,6 +163,12 @@ sudo ln -s /usr /run/current-system/sw ``` make sure /run isn't mounted. +##### Archbox didn't recognize commands +Add ```PATH``` variable to ```/etc/archbox.conf```, for example: +``` +ENV_VAR="PATH=/usr/bin:/usr/local/bin" +``` + #### PulseAudio refused to connect This can be caused by different dbus machine-id between chroot and host, copying ```/etc/machine-id``` from host to chroot should do the job. #### XDG_RUNTIME_DIR is not visible in Archbox diff --git a/install.sh b/install.sh index c0cbf20..c4623f3 100755 --- a/install.sh +++ b/install.sh @@ -27,14 +27,14 @@ ENV_VAR="${ENV_VAR:-}" # Parse a Systemd service and executes it on boot, order matters, for example: # -# SERVICES=( vmware-networks-configuration vmware-networks vmware-usbarbitrator php-fpm:3 nginx ) +# SERVICES="vmware-networks-configuration vmware-networks vmware-usbarbitrator php-fpm:3 nginx" # # Keep in mind that this doesn't resolve service dependencies, so you may need to # enable the dependencies manually. -SERVICES=( ${SERVICES:-} ) +SERVICES="${SERVICES:-}" # Share other host directories into Archbox, absolute path needed. -SHARED_FOLDER=( ${SHARED_FOLDERS:-/home} ) +SHARED_FOLDER="${SHARED_FOLDERS:-/home}" EOF } diff --git a/src/archbox b/src/archbox index 8f0fb0a..5fd3d05 100644 --- a/src/archbox +++ b/src/archbox @@ -2,8 +2,6 @@ . /etc/archbox.conf -set -- - # Text colors/formatting red="\033[38;5;1" green="\033[38;5;2" @@ -16,11 +14,11 @@ err(){ } msg(){ - printf "${green}${bold}%s${reset}\n" "==> $*" 1>&2 + printf "${green}${bold}%s${reset}\n" "==> $*" } checkdep(){ - command -v $1 2>/dev/null || err "Install $1!" + command -v $1 >/dev/null 2>&1 || err "Install $1!" } asroot(){ @@ -71,7 +69,8 @@ fetch_tarball(){ case $1 in -c|--create) asroot - [ $2 ] && err "Specify the link of Arch Linux bootstrap tarball!" + echo $2 + [ ! $2 ] && err "Specify the link of Arch Linux bootstrap tarball!" msg "Creating chroot directory..." mkdir -p $INSTALL_PATH cd $INSTALL_PATH @@ -91,7 +90,7 @@ case $1 in sed -i "s/CheckSpace/#CheckSpace/g" "${CHROOT}"/etc/pacman.conf msg "Mounting necessary filesystems..." "${PREFIX}"/share/archbox/bin/init start - cp "${PREFIX}"/share/archbox/chroot_setup.bash "${CHROOT}"/chroot_setup + cp "${PREFIX}"/share/archbox/chroot_setup "${CHROOT}"/chroot_setup printf "%s" $ARCHBOX_USER > /tmp/archbox_user chroot $CHROOT /bin/sh /chroot_setup exit $? diff --git a/src/archbox-desktop b/src/archbox-desktop index fba0672..1a47fe0 100644 --- a/src/archbox-desktop +++ b/src/archbox-desktop @@ -2,8 +2,6 @@ . /etc/archbox.conf >/dev/null 2>&1 -set -- - # Text colors/formatting red="\033[38;5;1" green="\033[38;5;2" @@ -31,7 +29,7 @@ install_desktop(){ } checkdep(){ - command -v $1 2>/dev/null || err "Install $1!" + command -v $1 >/dev/null 2>&1 || err "Install $1!" } help_text(){ diff --git a/src/chroot_setup b/src/chroot_setup index a269d73..ee080e7 100644 --- a/src/chroot_setup +++ b/src/chroot_setup @@ -1,7 +1,3 @@ -. /etc/archbox.conf >/dev/null 2>&1 - -set -- - # Text colors/formatting red="\033[38;5;1" green="\033[38;5;2" @@ -23,13 +19,16 @@ msg "Initializing pacman keyrings..." pacman-key --init pacman-key --populate archlinux msg "Installing essential packages..." -pacman -Syu base base-devel xorg pulseaudio nano --noconfirm +pacman -Syu base base-devel nano --noconfirm +printf "%s" "Do you want to use GUI apps? (y/n) " +read INSTALL_GUI +[ "$INSTALL_GUI" = "y" ] && pacman -Syu xorg pulseaudio --noconfirm msg "Installing archboxctl..." mkdir -p /usr/local/bin curl https://raw.githubusercontent.com/lemniskett/archboxctl/master/archboxctl.bash > /usr/local/bin/archboxctl chmod 755 /usr/local/bin/archboxctl msg "Setting up locale..." -printf "%s\n" "Uncomment needed locale, enter to continue" +printf "%s" "Uncomment needed locale, enter to continue" read nano /etc/locale.gen locale-gen @@ -38,6 +37,7 @@ printf "%s\n" "Enter your timezone, for example : \"Asia/Jakarta\"" while true; do read TIMEZONE \ && [ -e /usr/share/zoneinfo/$TIMEZONE ] \ + && rm -f /etc/localtime \ && ln -s /usr/share/zoneinfo/$TIMEZONE /etc/localtime \ && break \ || printf "%s\n" "Timezone not found, enter it again." diff --git a/src/enter b/src/enter index dd49350..ba71e66 100644 --- a/src/enter +++ b/src/enter @@ -7,4 +7,4 @@ REQ_ENV="DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} XDG_RUNTIME_DIR=${ ENV="$REQ_ENV $ENV_VAR" COMMAND="$@" -chroot $CHROOT /sbin/env $ENV /bin/su $ARCHBOX_USER +chroot $CHROOT /usr/bin/env $ENV /bin/su $ARCHBOX_USER diff --git a/src/exec b/src/exec index c46ee3c..fa33147 100644 --- a/src/exec +++ b/src/exec @@ -7,4 +7,4 @@ REQ_ENV="DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} XDG_RUNTIME_DIR=${ ENV="$REQ_ENV $ENV_VAR" COMMAND="$@" -chroot $CHROOT /bin/su -c "env $ENV $COMMAND" $ARCHBOX_USER +chroot $CHROOT /bin/su -c "/usr/bin/env $ENV $COMMAND" $ARCHBOX_USER diff --git a/src/init b/src/init index 81ee364..1f2e07b 100644 --- a/src/init +++ b/src/init @@ -18,19 +18,19 @@ msg(){ } rbind(){ - if mount | grep "${CHROOT}"${1} >/dev/null 2>&1; then + if [ "$(mount | grep "${CHROOT}"${1} >/dev/null 2>&1)" ]; then msg "${CHROOT}${1} already mounted." else mount -R $1 "${CHROOT}"${1} msg "${CHROOT}${1} mounted!" fi - if [ $2 = "make-rslave" ]; then + if [ "$2" = "make-rslave" ]; then mount --make-rslave ${CHROOT}${1} fi } rbind_diff() { - if mount | grep "${CHROOT}"${2}; then + if [ "$(mount | grep "${CHROOT}"${2})" ]; then msg "$CHROOT$2 already mounted." else mount -R $1 "${CHROOT}"${2} @@ -39,18 +39,18 @@ rbind_diff() { } bindproc() { - if mount | grep "${CHROOT}"/proc; then + if [ "$(mount | grep "${CHROOT}"/proc)" ]; then msg "${CHROOT}/proc already mounted." else mount -t proc /proc "${CHROOT}"/proc - msg "${CHROOT}/proc mounted!") + msg "${CHROOT}/proc mounted!" fi } rmbind() { umount_args=-R - [ $LAZY_UMOUNT = "yes" ] && umount_args=-Rl - if mount | grep "${CHROOT}"${1}; then + [ "$LAZY_UMOUNT" = "yes" ] && umount_args=-Rl + if [ "$(mount | grep "${CHROOT}"${1})" ]; then umount $umount_args "${CHROOT}"${1} msg "${CHROOT}${1} unmounted!" fi @@ -62,8 +62,8 @@ case $1 in rbind /tmp rbind /sys make-rslave rbind /dev make-rslave - [ $MOUNT_RUN = "yes" ] && rbind /run - if [ $MOUNT_MOD = "yes" ]; then + [ "$MOUNT_RUN" = "yes" ] && rbind /run + if [ "$MOUNT_MOD" = "yes" ]; then rbind "$(readlink -f /lib/modules)" rbind /boot fi