Add necessary packages for setup and replace bash by zsh

* a text editor is required to setup netctl profile after reboot
* git client is necessary to checkout repo for config after reboot
This commit is contained in:
Clément Bouchard 2022-07-11 17:43:14 +02:00
parent 9af1a3a1a5
commit 6017af595f
4 changed files with 388 additions and 3 deletions

View File

@ -19,6 +19,7 @@ What has been configured
* Hostname cb-system
* Username set to cb
* Configure package multilib (mainly for display drivers)
* Install necessary packages - git (checkout repo for config) & vim (configure netctl profile)
What has been manually edited in scripts

88
alis-packages.conf Normal file
View File

@ -0,0 +1,88 @@
# Arch Linux Install Script (alis) configuration file
#
# Some variables values are preceded by a ! character, this means that the value is ignored.
# Some variables accept a single value others accept multiple values as annotated in the comments.
# Some variables are boolean with a value of true or false.
#
# Read the Arch Linux wiki pages to learn more about the variables values.
# https://github.com/picodotdev/alis/blob/master/README.md
# init
## LOG_TRACE outputs the comands executed.
## LOG_FILE generates a log file with the commands executed and output generated during installation.
### The log file is saved to /var/log/alis-packages.log.
LOG_TRACE="true"
LOG_FILE="false"
# pacman
## Arch Linux packages to install
## more at https://www.archlinux.org/packages/
## PACKAGES_PACMAN_CUSTOM_REPOSITORIES custom repositories to add to pacman configuration, see https://archlinux.org/pacman/pacman.conf.5.html#_repository_sections
### Comment lines starting with # charater are removed
PACKAGES_PACMAN_INSTALL="true"
PACKAGES_PACMAN_INSTALL_PIPEWIRE="false"
PACKAGES_PACMAN_INTERNET="!firefox !chromium !curl !wget !filezilla !sshfs !openssh !transmission-gtk !transmission-qt !liferea !gnome-boxes !gnome-tweaks"
PACKAGES_PACMAN_MULTIMEDIA="!gthumb !gimp !imagemagick !krita !inkscape !blender !cmus !vlc !easytag !ardour !audacity !ffmpeg !gnome-phone-manager !kdeconnect !gstreamer !gst-plugins-good !gst-plugins-bad !gst-plugins-ugly !bluez !bluez-utils"
PACKAGES_PACMAN_UTILITIES="!bash-completion !chezmoi !gnome-initial-setup !gnome-extra !code !lz4 !meld !dosfstools !ntfs-3g !exfat-utils !man-db !man-pages"
PACKAGES_PACMAN_DOCUMENTS_AND_TEXT="!libreoffice-fresh !calligra !discount !lyx vim !calibre"
PACKAGES_PACMAN_COMMUNICATION="!geary !thunderbird !empathy !kopete !polari !konversation"
PACKAGES_PACMAN_GAMES=""
PACKAGES_PACMAN_SECURITY="!ufw !rsync !gnupg !keepassxc !encfs"
PACKAGES_PACMAN_SCIENCE="!geogebra !octave"
PACKAGES_PACMAN_OTHERS="!klavaro !tmux"
PACKAGES_PACMAN_DEVELOPER="git !python !dotnet-sdk !php !rust !go !virtualbox !docker !ansible !vagrant !packer !terraform !vault !consul !nomad"
PACKAGES_PACMAN_CUSTOM=""
PACKAGES_PACMAN_PIPEWIRE="pipewire pipewire-pulse pipewire-alsa wireplumber !pipewire-jack !helvum !xdg-desktop-portal !xdg-desktop-portal-gnome !xdg-desktop-portal-kde !xdg-desktop-portal-wlr"
PACKAGES_PACMAN_CUSTOM_REPOSITORIES="
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
"
## Flatpak packages to install
## more at https://flathub.org/apps/collection/popular
PACKAGES_FLATPAK_INSTALL="false"
PACKAGES_FLATPAK_INTERNET=""
PACKAGES_FLATPAK_MULTIMEDIA="!com.spotify.Client !org.ardour.Ardour !org.audacityteam.Audacity !tv.kodi.Kodi !org.pitivi.Pitivi"
PACKAGES_FLATPAK_UTILITIES="!org.freefilesync.FreeFileSync !org.gnome.World.PikaBackup !com.dropbox.Client"
PACKAGES_FLATPAK_DOCUMENTS_AND_TEXT="!org.onlyoffice.desktopeditors !com.wps.Office"
PACKAGES_FLATPAK_COMMUNICATION="!com.slack.Slack !com.microsoft.Teams !org.jitsi.jitsi-meet !us.zoom.Zoom !org.telegram.desktop"
PACKAGES_FLATPAK_GAMES="!com.valvesoftware.Steam !org.wesnoth.Wesnoth !com.albiononline.AlbionOnline !org.hedgewars.Hedgewars !com.mojang.Minecraft !net.supertuxkart.SuperTuxKart !org.openttd.OpenTTD"
PACKAGES_FLATPAK_SECURITY=""
PACKAGES_FLATPAK_SCIENCE=""
PACKAGES_FLATPAK_OTHERS="!org.gnucash.GnuCash"
PACKAGES_FLATPAK_DEVELOPER="!com.jetbrains.IntelliJ-IDEA-Community !org.eclipse.Java !com.getpostman.Postman"
PACKAGES_FLATPAK_CUSTOM=""
## SDKMAN packages to install
## more at https://sdkman.io/jdks and https://sdkman.io/sdks
PACKAGES_SDKMAN_INSTALL="false"
PACKAGES_SDKMAN_JDKS="!java !java:17.0.1-tem !java:11.0.13-tem !java:8.0.312-tem" # format <candidate>:[version]:[local-path]
PACKAGES_SDKMAN_SDKS="!gradle !maven !kotlin !groovy" # format <candidate>:[version]:[local-path]
## AUR utility and AUR packages to install
## more at https://aur.archlinux.org/packages/
PACKAGES_AUR_INSTALL="false"
PACKAGES_AUR_COMMAND="!paru-bin !yay-bin paru !yay !aurman"
PACKAGES_AUR_INTERNET=""
PACKAGES_AUR_MULTIMEDIA=""
PACKAGES_AUR_UTILITIES=""
PACKAGES_AUR_DOCUMENTS_AND_TEXT=""
PACKAGES_AUR_COMMUNICATION=""
PACKAGES_AUR_GAMES=""
PACKAGES_AUR_SECURITY=""
PACKAGES_AUR_SCIENCE=""
PACKAGES_AUR_OTHERS=""
PACKAGES_AUR_DEVELOPER=""
PACKAGES_AUR_CUSTOM=""
PACKAGES_PACMAN="$PACKAGES_PACMAN_INTERNET $PACKAGES_PACMAN_MULTIMEDIA $PACKAGES_PACMAN_UTILITIES $PACKAGES_PACMAN_DOCUMENTS_AND_TEXT $PACKAGES_PACMAN_COMMUNICATION $PACKAGES_PACMAN_GAMES $PACKAGES_PACMAN_SECURITY $PACKAGES_PACMAN_SCIENCE $PACKAGES_PACMAN_OTHERS $PACKAGES_PACMAN_DEVELOPER $PACKAGES_PACMAN_CUSTOM"
PACKAGES_FLATPAK="$PACKAGES_FLATPAK_INTERNET $PACKAGES_FLATPAK_MULTIMEDIA $PACKAGES_FLATPAK_UTILITIES $PACKAGES_FLATPAK_DOCUMENTS_AND_TEXT $PACKAGES_FLATPAK_COMMUNICATION $PACKAGES_FLATPAK_GAMES $PACKAGES_FLATPAK_SECURITY $PACKAGES_FLATPAK_SCIENCE $PACKAGES_FLATPAK_OTHERS $PACKAGES_FLATPAK_DEVELOPER $PACKAGES_FLATPAK_CUSTOM"
PACKAGES_SDKMAN="$PACKAGES_SDKMAN_JDKS $PACKAGES_SDKMAN_SDKS"
PACKAGES_AUR="$PACKAGES_AUR_INTERNET $PACKAGES_AUR_MULTIMEDIA $PACKAGES_AUR_UTILITIES $PACKAGES_AUR_DOCUMENTS_AND_TEXT $PACKAGES_AUR_COMMUNICATION $PACKAGES_AUR_GAMES $PACKAGES_AUR_SECURITY $PACKAGES_AUR_SCIENCE $PACKAGES_AUR_OTHERS $PACKAGES_AUR_DEVELOPER $PACKAGES_AUR_CUSTOM"
# systemd
## SYSTEMD_UNITS systemd units to enable or disable.
### If preceded with a "+" unit is enabled, if preceded with "-" unit is disabled, if preceded with "!" unit is ignored (no action is performed).
### eg. "+ufw.service" to enable, "-ufw.service" to disable, "!ufw.service" to ignore
SYSTEMD_UNITS="!ufw.service !bluetooth.service !docker.service"

296
alis-packages.sh Normal file
View File

@ -0,0 +1,296 @@
#!/usr/bin/env bash
set -eu
# Arch Linux Install Script Packages (alis-packages) installs software
# packages.
# Copyright (C) 2022 picodotdev
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script is hosted at https://github.com/picodotdev/alis. For new features,
# improvements and bugs fill an issue in GitHub or make a pull request.
# Pull Request are welcome!
#
# If you test it in real hardware please send me an email to pico.dev@gmail.com with
# the machine description and tell me if somethig goes wrong or all works fine.
#
# Please, don't ask for support for this script in Arch Linux forums, first read
# the Arch Linux wiki [1], the Installation Guide [2] and the General
# Recomendations [3], later compare the commands with those of this script.
#
# [1] https://wiki.archlinux.org
# [2] https://wiki.archlinux.org/index.php/Installation_guide
# [3] https://wiki.archlinux.org/index.php/General_recommendations
# Installs packages in a Arch Linux system.
#
# Usage:
# # loadkeys es
# # curl -sL https://raw.githubusercontent.com/picodotdev/alis/master/download.sh | bash
# # vim alis-packages.conf
# # ./alis-packages.sh
PACKAGES_STANDALONE="false"
function init_config() {
local COMMONS_FILE="alis-commons.sh"
source "$COMMONS_FILE"
if [ "$PACKAGES_STANDALONE" == "true" ]; then
source "$COMMONS_CONF_FILE"
fi
source "$PACKAGES_CONF_FILE"
}
function sanitize_variables() {
PACKAGES_PACMAN=$(sanitize_variable "$PACKAGES_PACMAN")
PACKAGES_PACMAN_PIPEWIRE=$(sanitize_variable "$PACKAGES_PACMAN_PIPEWIRE")
PACKAGES_FLATPAK=$(sanitize_variable "$PACKAGES_FLATPAK")
PACKAGES_SDKMAN=$(sanitize_variable "$PACKAGES_SDKMAN")
PACKAGES_AUR_COMMAND=$(sanitize_variable "$PACKAGES_AUR_COMMAND")
PACKAGES_AUR=$(sanitize_variable "$PACKAGES_AUR")
SYSTEMD_UNITS=$(sanitize_variable "$SYSTEMD_UNITS")
}
function check_variables() {
check_variables_boolean "PACKAGES_PACMAN_INSTALL" "$PACKAGES_PACMAN_INSTALL"
check_variables_boolean "PACKAGES_PACMAN_INSTALL_PIPEWIRE" "$PACKAGES_PACMAN_INSTALL_PIPEWIRE"
check_variables_boolean "PACKAGES_FLATPAK_INSTALL" "$PACKAGES_FLATPAK_INSTALL"
check_variables_boolean "PACKAGES_SDKMAN_INSTALL" "$PACKAGES_SDKMAN_INSTALL"
check_variables_boolean "PACKAGES_AUR_INSTALL" "$PACKAGES_AUR_INSTALL"
check_variables_list "PACKAGES_AUR_COMMAND" "$PACKAGES_AUR_COMMAND" "paru-bin yay-bin paru yay aurman" "true" "false"
}
function init() {
if [ "$PACKAGES_STANDALONE" == "true" ]; then
init_log_trace "$LOG_TRACE"
init_log_file "$LOG_FILE" "$PACKAGES_LOG_FILE"
fi
}
function facts() {
print_step "facts()"
facts_commons
if [ -z "$USER_NAME" ]; then
USER_NAME="$(whoami)"
fi
}
function checks() {
print_step "checks()"
check_variables_value "USER_NAME" "$USER_NAME"
if [ -n "$PACKAGES_PACMAN" ]; then
execute_sudo "pacman -Syi $PACKAGES_PACMAN"
fi
if [ "$SYSTEM_INSTALLATION" == "false" ]; then
ask_sudo
fi
}
function ask_sudo() {
sudo pwd >> /dev/null
}
function prepare() {
print_step "prepare()"
}
function packages() {
print_step "packages()"
packages_pacman
packages_flatpak
packages_sdkman
packages_aur
}
function packages_pacman() {
print_step "packages_pacman()"
if [ "$PACKAGES_PACMAN_INSTALL" == "true" ]; then
local CUSTOM_REPOSITORIES="$(echo "$PACKAGES_PACMAN_CUSTOM_REPOSITORIES" | grep -E "^[^#]|\n^$"; exit 0)"
if [ -n "$CUSTOM_REPOSITORIES" ]; then
execute_sudo "echo -e \"# alis\n$CUSTOM_REPOSITORIES\" >> /etc/pacman.conf"
fi
if [ -n "$PACKAGES_PACMAN" ]; then
pacman_install "$PACKAGES_PACMAN"
fi
if [[ ("$PACKAGES_PIPEWIRE" == "true" || "$PACKAGES_PACMAN_INSTALL_PIPEWIRE" == "true") && -n "$PACKAGES_PACMAN_PIPEWIRE" ]]; then
if [ -n "$(echo "$PACKAGES_PACMAN_PIPEWIRE" | grep -F -w "pipewire-pulse")" ]; then
pacman_uninstall "pulseaudio pulseaudio-bluetooth"
fi
if [ -n "$(echo "$PACKAGES_PACMAN_PIPEWIRE" | grep -F -w "pipewire-jack")" ]; then
pacman_uninstall "jack2"
fi
pacman_install "$PACKAGES_PACMAN_PIPEWIRE"
#if [ -n "$(echo "$PACKAGES_PACMAN_PIPEWIRE" | grep -F -w "pipewire-pulse")" ]; then
# execute_user "$USER_NAME" "systemctl enable --user pipewire-pulse.service"
#fi
fi
fi
}
function packages_flatpak() {
print_step "packages_flatpak()"
if [ "$PACKAGES_FLATPAK_INSTALL" == "true" ]; then
pacman_install "flatpak"
if [ -n "$PACKAGES_FLATPAK" ]; then
execute_flatpak "flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo"
flatpak_install "$PACKAGES_FLATPAK"
fi
fi
}
function packages_sdkman() {
print_step "packages_sdkman()"
if [ "$PACKAGES_SDKMAN_INSTALL" == "true" ]; then
pacman_install "zip unzip"
execute_user "$USER_NAME" "curl -s https://get.sdkman.io | bash"
if [ -n "$PACKAGES_SDKMAN" ]; then
execute_user "$USER_NAME" "sed -i 's/sdkman_auto_answer=.*/sdkman_auto_answer=true/g' /home/$USER_NAME/.sdkman/etc/config"
sdkman_install "$PACKAGES_SDKMAN"
execute_user "$USER_NAME" "sed -i 's/sdkman_auto_answer=.*/sdkman_auto_answer=false/g' /home/$USER_NAME/.sdkman/etc/config"
fi
fi
}
function packages_aur() {
print_step "packages_aur()"
if [ "$PACKAGES_AUR_INSTALL" == "true" ]; then
IFS=' ' local COMMANDS=($PACKAGES_AUR_COMMAND)
for COMMAND in "${COMMANDS[@]}"
do
aur_command_install "$USER_NAME" "$COMMAND"
done
AUR_PACKAGE="${COMMANDS[0]}"
case "${AUR_PACKAGE}" in
"aurman" )
AUR_COMMAND="aurman"
;;
"yay" )
AUR_COMMAND="yay"
;;
"paru" )
AUR_COMMAND="paru"
;;
"yay-bin" )
AUR_COMMAND="yay"
;;
"paru-bin" | *)
AUR_COMMAND="paru"
;;
esac
if [ -n "$PACKAGES_AUR" ]; then
aur_install "$PACKAGES_AUR"
fi
fi
}
function flatpak_install() {
local OPTIONS=""
if [ "$SYSTEM_INSTALLATION" == "true" ]; then
local OPTIONS="--system"
fi
local ERROR="true"
set +e
IFS=' ' local PACKAGES=($1)
for VARIABLE in {1..5}
do
local COMMAND="flatpak install $OPTIONS -y flathub ${PACKAGES[@]}"
execute_flatpak "$COMMAND"
if [ $? == 0 ]; then
local ERROR="false"
break
else
sleep 10
fi
done
set -e
if [ "$ERROR" == "true" ]; then
return
fi
}
function sdkman_install() {
local ERROR="true"
set +e
IFS=' ' local PACKAGES=($1)
for PACKAGE in "${PACKAGES[@]}"
do
IFS=':' local PACKAGE=($PACKAGE)
for VARIABLE in {1..5}
do
local COMMAND="source /home/$USER_NAME/.sdkman/bin/sdkman-init.sh && sdk install ${PACKAGE[@]}"
execute_user "$USER_NAME" "$COMMAND"
if [ $? == 0 ]; then
local ERROR="false"
break
else
sleep 10
fi
done
done
set -e
if [ "$ERROR" == "true" ]; then
return
fi
}
function end() {
echo ""
echo -e "${GREEN}Arch Linux packages installed successfully"'!'"${NC}"
echo ""
}
function main() {
local START_TIMESTAMP=$(date -u +"%F %T")
set +u
if [ "$COMMOMS_LOADED" != "true" ]; then
PACKAGES_STANDALONE="true"
fi
set -u
init_config
execute_step "sanitize_variables"
execute_step "check_variables"
execute_step "init"
execute_step "facts"
execute_step "checks"
execute_step "prepare"
execute_step "packages"
execute_step "systemd_units"
local END_TIMESTAMP=$(date -u +"%F %T")
local INSTALLATION_TIME=$(date -u -d @$(($(date -d "$END_TIMESTAMP" '+%s') - $(date -d "$START_TIMESTAMP" '+%s'))) '+%T')
echo -e "Installation packages start ${WHITE}$START_TIMESTAMP${NC}, end ${WHITE}$END_TIMESTAMP${NC}, time ${WHITE}$INSTALLATION_TIME${NC}"
execute_step "end"
}
main $@

View File

@ -143,7 +143,7 @@ BOOTLOADER="auto !grub !refind !systemd" # (single)
# shell
## CUSTOM_SHELL configures an alternative custom shell interpreter.
CUSTOM_SHELL="bash !zsh !dash !fish" # (single)
CUSTOM_SHELL="!bash zsh !dash !fish" # (single)
# desktop
## DESKTOP_ENVIRONMENT installs a desktop environment.
@ -155,7 +155,7 @@ DESKTOP_ENVIRONMENT="!gnome !kde !xfce !mate !cinnamon !lxde !i3-wm !i3-gaps !de
## PACKAGES_PIPEWIRE installs PipeWire replacing PulseAudio, requires PACKAGES_INSTALL="true".
### It is recommended to install packages after base installation and reboot.
PACKAGES_MULTILIB="true"
PACKAGES_INSTALL="false"
PACKAGES_INSTALL="true"
PACKAGES_PIPEWIRE="false"
# provision