diff options
author | pico.dev <pico.dev@gmail.com> | 2020-04-29 18:13:18 +0200 |
---|---|---|
committer | pico.dev <pico.dev@gmail.com> | 2020-04-29 18:13:18 +0200 |
commit | 31782fae98ae7075a3e837f16287a1ad1fa12ba2 (patch) | |
tree | 6e067b62786e40c354fafd8759e2171ff6958f3b | |
parent | c359ef46e6963b617d019f3f6663421d0f4accea (diff) |
Allow enable or disable systemd units
Fixes #87
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | alis.conf | 3 | ||||
-rw-r--r-- | alis.sh | 37 | ||||
-rw-r--r-- | site/content/index.markdown | 5 |
4 files changed, 33 insertions, 13 deletions
@@ -46,6 +46,7 @@ For new features, improvements and bugs fill an issue in GitHub or make a pull r * Kernel compression and custom parameters * Users creation and add to sudoers * Common and custom packages installation +* Systemd units enable or disable * AUR utility installation (aurman, yay) * Script for download installation and recovery scripts and configuration files * Retry packages download on connection/mirror error @@ -93,5 +93,8 @@ PACKAGES_AUR_CUSTOM="" PACKAGES_PACMAN="$PACKAGES_PACMAN_INTERNET $PACKAGES_PACMAN_MULTIMEDIA $PACKAGES_PACMAN_UTILITIES $PACKAGES_PACMAN_DOCUMENTS_AND_TEXT $PACKAGES_PACMAN_SECURITY $PACKAGES_PACMAN_SCIENCE $PACKAGES_PACMAN_OTHERS $PACKAGES_PACMAN_DEVELOPER $PACKAGES_PACMAN_CUSTOM" PACKAGES_AUR="$PACKAGES_AUR_INTERNET $PACKAGES_AUR_MULTIMEDIA $PACKAGES_AUR_UTILITIES $PACKAGES_AUR_DOCUMENTS_AND_TEXT $PACKAGES_AUR_SECURITY $PACKAGES_AUR_SCIENCE $PACKAGES_AUR_OTHERS $PACKAGES_AUR_DEVELOPER $PACKAGES_AUR_CUSTOM" +# systemd +SYSTEMD_UNITS="" # eg. "ufw.service nginx.service" to enable, "!uwf.service !nginx.service" to disable + #reboot REBOOT="true" @@ -66,8 +66,6 @@ CPU_VENDOR="" VIRTUALBOX="" CMDLINE_LINUX_ROOT="" CMDLINE_LINUX="" -ADDITIONAL_USER_NAMES_ARRAY=() -ADDITIONAL_USER_PASSWORDS_ARRAY=() CONF_FILE="alis.conf" LOG_FILE="alis.log" @@ -80,8 +78,6 @@ NC='\033[0m' function configuration_install() { source alis.conf - ADDITIONAL_USER_NAMES_ARRAY=($ADDITIONAL_USER_NAMES) - ADDITIONAL_USER_PASSWORDS_ARRAY=($ADDITIONAL_USER_PASSWORDS) } function sanitize_variables() { @@ -1029,6 +1025,8 @@ function users() { done arch-chroot /mnt sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers + + pacman_install "xdg-user-dirs" } function create_user() { @@ -1036,8 +1034,6 @@ function create_user() { USER_PASSWORD=$2 arch-chroot /mnt useradd -m -G wheel,storage,optical -s /bin/bash $USER_NAME printf "$USER_PASSWORD\n$USER_PASSWORD" | arch-chroot /mnt passwd $USER_NAME - - pacman_install "xdg-user-dirs" } function desktop_environment() { @@ -1209,6 +1205,20 @@ function packages_aur() { arch-chroot /mnt sed -i 's/%wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers } +function systemd() { + IFS=' ' UNITS=($SYSTEMD_UNITS) + for U in ${UNITS[@]}; do + UNIT=${U} + if [[ $UNIT == !* ]]; then + ACTION="disable" + else + ACTION="enable" + fi + UNIT=$(echo $UNIT | sed "s/!//g") + arch-chroot /mnt systemctl $ACTION $UNIT + done +} + function terminate() { cp "$CONF_FILE" "/mnt/etc/$CONF_FILE" @@ -1270,33 +1280,37 @@ function end() { } function pacman_install() { - PACKAGES=$1 + set +e + IFS=' ' PACKAGES=($1) for VARIABLE in {1..5} do - arch-chroot /mnt pacman -Syu --noconfirm --needed $PACKAGES + arch-chroot /mnt pacman -Syu --noconfirm --needed ${PACKAGES[@]} if [ $? == 0 ]; then break else sleep 10 fi done + set -e } function aur_install() { - PACKAGES=$1 + set +e + IFS=' ' PACKAGES=($1) for VARIABLE in {1..5} do - arch-chroot /mnt bash -c "echo -e \"$USER_PASSWORD\n$USER_PASSWORD\n$USER_PASSWORD\n$USER_PASSWORD\n\" | su $USER_NAME -c \"$AUR -Syu --noconfirm --needed $PACKAGES\"" + arch-chroot /mnt bash -c "echo -e \"$USER_PASSWORD\n$USER_PASSWORD\n$USER_PASSWORD\n$USER_PASSWORD\n\" | su $USER_NAME -c \"$AUR -Syu --noconfirm --needed ${PACKAGES[@]}\"" if [ $? == 0 ]; then break else sleep 10 fi done + set -e } function print_step() { - STEP=$1 + STEP="$1" echo "" echo -e "${LIGHT_BLUE}# ${STEP} step${NC}" echo "" @@ -1327,6 +1341,7 @@ function main() { desktop_environment fi packages + systemd terminate end } diff --git a/site/content/index.markdown b/site/content/index.markdown index 25aff28..2df9168 100644 --- a/site/content/index.markdown +++ b/site/content/index.markdown @@ -88,10 +88,10 @@ url: "/" </div> <div class="content-wrapper"> <ul> - <li>System: GPT, UEFI, BIOS</li> + <li>System: UEFI, BIOS</li> <li>Storage: SATA, NVMe and MMC</li> <li>Encryption: root partition encrypted and no encrypted</li> - <li>Partition: no LVM, LVM, LVM on LUKS</li> + <li>Partition: no LVM, LVM, LVM on LUKS, GPT on UEFI, MBR on BIOS</li> <li>File system: ext4, btrfs (with subvols), xfs</li> <li>Optional file swap (not supported in btrfs)</li> <li>Storage: SATA, NVMe and MMC</li> @@ -108,6 +108,7 @@ url: "/" <li>Kernel compression and custom parameters</li> <li>Users creation and add to sudoers</li> <li>Common and custom packages installation</li> + <li>Systemd units enable or disable</li> <li>AUR utility installation (aurman, yay)</li> <li>Script for download installation and recovery scripts and configuration files</li> <li>Retry packages download on connection/mirror error</li> |