installer: refactor! xfce4: remove firefox and add pulseaudio

This commit is contained in:
Daniel Langbein 2021-06-22 13:52:41 +02:00
parent 7fa7035990
commit 894473c306
14 changed files with 157 additions and 233 deletions

View File

@ -2,7 +2,7 @@
_pkgname=installer
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.1.16
pkgver=0.1.17
pkgrel=1
pkgdesc="Bash script to install Arch Linux"
arch=('any')

View File

@ -15,7 +15,8 @@ function main() {
# installation finished
check_network || return $?
# out: BIOS_TYPE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD
# in: BOOT_FIRMWARE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD (all optional)
# out: BOOT_FIRMWARE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD
get_user_input || return $?
# in: CPU_VENDOR (optional)
# out: CPU_VENDOR
@ -25,29 +26,32 @@ function main() {
# out: FS_DEFAULT_MOUNT_OPTIONS
get_default_mount_options || return $?
# in: FS
# out: FS_CHOSEN_MOUNT_OPTIONS
choose_mount_options || return $?
# out: FS_ADDITIONAL_MOUNT_OPTIONS
get_additional_mount_options || return $?
# in: TARGET_BLOCK_DEVICE, BIOS_TYPE
# in: TARGET_BLOCK_DEVICE, BOOT_FIRMWARE
# out: BOOT_PART, LUKS_PART
partition || return $?
# in: BIOS_TYPE, BOOT_PART, LUKS_PART, LUKS_PWD, FS
# in: BOOT_FIRMWARE, BOOT_PART, LUKS_PART, LUKS_PWD, FS
# out: LUKS_PART_UUID, DATA_PART
format || return $?
# Combine default and chosen mount options
TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_CHOSEN_MOUNT_OPTIONS[@]}") || return $?
# Combine default and additional mount options
# out: FS_MOUNT_OPTIONS
{
TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_ADDITIONAL_MOUNT_OPTIONS[@]}") || return $?
# Join array elements by ","
join_by "," TMP1 FS_MOUNT_OPTIONS || return $?
join_by ',' TMP1 FS_MOUNT_OPTIONS || return $?
}
echo "Mounting data partition with options: ${FS_MOUNT_OPTIONS}"
sudo mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $?
echo 'Mounting data partition with options: '"${FS_MOUNT_OPTIONS}"
sudo mount -o "${FS_MOUNT_OPTIONS}" "${DATA_PART}" /mnt || return $?
echo "Mounting boot partition ..."
echo 'Mounting boot partition ...'
mkdir /mnt/boot || return $?
sudo mount "$BOOT_PART" /mnt/boot || return $?
sudo mount "${BOOT_PART}" /mnt/boot || return $?
# in: BIOS_TYPE
# in: BOOT_FIRMWARE
run_pacstrap || return $?
# in: FS
run_genfstab || return $?
@ -61,19 +65,19 @@ function main() {
# in: TARGET_BLOCK_DEVICE, LUKS_PART_UUID
bootloader || return $?
if [ "${LEAVE_MOUNTED}" -eq "1" ]; then
echo "Leaving partitions below /mnt mounted and ${DATA_PART} opened."
if [ "${LEAVE_MOUNTED}" -eq '1' ]; then
echo 'Leaving partitions below /mnt mounted and '"${DATA_PART}"' opened.'
else
sudo umount -R /mnt || return $?
sudo cryptsetup luksClose "$(basename "${DATA_PART}")" || return $?
fi
echo "Finished installation without errors!"
echo 'Finished installation without errors!'
}
function check_network() {
echo "Sending ping to wikipedia.de ..."
echo 'Sending ping to wikipedia.de ...'
ping -c 1 wikipedia.de >/dev/null || {
echo "Pleas set up network access."
echo 'Pleas set up network access.'
return 1
}
}
@ -84,64 +88,65 @@ function increase_cow_space() {
# make sure that we are on a live medium:
findmnt /run/archiso/cowspace >/dev/null || {
echo "Not on live medium, did not increase cowspace!"
echo 'Not on live medium, did not increase cowspace!'
return 1
}
echo "Increasing cowspace partition of live medium ..."
echo 'Increasing cowspace partition of live medium ...'
sudo mount -o remount,size=2G /run/archiso/cowspace || return $?
}
function get_user_input() {
# @post
# BIOS_TYPE (uefi or bios)
# BOOT_FIRMWARE (uefi or bios)
# FS (BTRFS, EXT4, F2FS)
# HOSTNAME
# USERNAME, USER_PWD
# LUKS_PWD
get_block_devices_with_size || return $?
get_single_choice TARGET_BLOCK_DEVICE "Select target device for installation" BLOCK_DEVICE_SIZES || return $?
get_single_choice TARGET_BLOCK_DEVICE 'Select target device for installation' BLOCK_DEVICE_SIZES || return $?
if [ "${BIOS_TYPE}" = "autodetect" ]; then
ask_user_if_empty BOOT_FIRMWARE 'Enter desired boot firmware. Valid options are "bios", "uefi" or "autodetect":' || return $?
if [ "${BOOT_FIRMWARE}" = 'autodetect' ]; then
# Detect BIOS type: https://askubuntu.com/a/162573
# Check exit code; if 0 EFI, else BIOS.
# "-q": tell grep to output nothing
if dmesg | grep -q "EFI v"; then
echo "Detected EFI boot."
BIOS_TYPE="uefi"
if dmesg | grep -q 'EFI v'; then
echo 'Detected EFI boot.'
BOOT_FIRMWARE='uefi'
else
echo "Detected BIOS boot"
BIOS_TYPE="bios"
echo 'Detected BIOS boot'
BOOT_FIRMWARE='bios'
fi
else
# Let user select BIOS type
TMP1=('uefi' 'Newer mainboards' 'bios' 'Legacy BIOS on older mainboards')
get_single_choice BIOS_TYPE "Select your bios type" TMP1 || return $?
get_single_choice BOOT_FIRMWARE 'Select your bios type' TMP1 || return $?
fi
TMP1=('BTRFS' 'Allows snapshots and dynamic extension of the FS' 'EXT4' 'Default FS of many distributions' 'F2FS' 'Flash-Friendly-FS for SSD or NVMe')
get_single_choice FS "Select filesystem to use" TMP1 || return $?
get_single_choice FS 'Select filesystem to use' TMP1 || return $?
get_text_input HOSTNAME "Enter hostname:" || return $?
get_text_input USERNAME "Enter username:" || return $?
ask_user_if_empty HOSTNAME 'Enter hostname:' || return $?
ask_user_if_empty USERNAME 'Enter username:' || return $?
if [ -z "${USER_PWD}" ]; then
get_text_input USER_PWD "Enter a user password:" || return $?
get_text_input USER_PWD2 "Please enter the password again:" || return $?
ask_user_if_empty USER_PWD 'Enter a user password:' || return $?
ask_user_if_empty USER_PWD2 'Please enter the password again:' || return $?
[[ "${USER_PWD}" == "${USER_PWD2}" ]] || {
echo "Passwords did not match";
echo 'Passwords did not match';
exit 1;
}
fi
if [ -z "${LUKS_PWD}" ]; then
get_text_input LUKS_PWD "Enter a disk encryption password:" || return $?
get_text_input LUKS_PWD2 "Please enter the password again:" || return $?
ask_user_if_empty LUKS_PWD 'Enter a disk encryption password:' || return $?
ask_user_if_empty LUKS_PWD2 'Please enter the password again:' || return $?
[[ "${LUKS_PWD}" == "${LUKS_PWD2}" ]] || {
echo "Passwords did not match";
echo 'Passwords did not match';
exit 1;
}
fi
@ -176,17 +181,17 @@ function get_default_mount_options() {
FS_DEFAULT_MOUNT_OPTIONS+=('compress_algorithm=lz4')
;;
*)
echo "Filesystem $FS not yet supported!"
echo 'Filesystem '"$FS"' not yet supported!'
return 1
;;
esac
}
function choose_mount_options() {
function get_additional_mount_options() {
# @pre
# FS
# @post
# FS_CHOSEN_MOUNT_OPTIONS (array)
# FS_ADDITIONAL_MOUNT_OPTIONS (array)
case "${FS}" in
BTRFS)
@ -196,40 +201,41 @@ function choose_mount_options() {
# - The noatime option fully disables writing file access times to the drive every time you read a file.
# This works well for almost all applications, except for those that need to know if a file has been
# read since the last time it was modified.
TMP1=('noatime' "Don't write file/folder access times" 'on' 'ssd' 'Enable if using SSD/NVMe' 'off')
TMP1=('noatime' 'Don'\''t write file/folder access times' 'on' 'ssd' 'Enable if using SSD/NVMe' 'off')
;;
EXT4)
TMP1=('noatime'" Don't write file/folder access times" 'on')
TMP1=('noatime' 'Don'\''t write file/folder access times' 'on')
;;
F2FS)
TMP1=('noatime' "Don't write file/folder access times" 'on')
# shellcheck disable=SC2034
TMP1=('noatime' 'Don'\''t write file/folder access times' 'on')
;;
*)
echo "Filesystem $FS not yet supported!"
echo 'Filesystem '"$FS"' not yet supported!'
return 1
;;
esac
get_multi_choice FS_CHOSEN_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
get_multi_choice FS_ADDITIONAL_MOUNT_OPTIONS 'Select mount options' TMP1 || return $?
}
function run_pacstrap() {
# @pre
# BIOS_TYPE
# BOOT_FIRMWARE
echo "Running pacstrap ..."
echo 'Running pacstrap ...'
PKGS=("${ADDITIONAL_PKGS[@]}")
case "${BIOS_TYPE}" in
case "${BOOT_FIRMWARE}" in
uefi)
PKGS+=('de-p1st-base')
;;
bios)
echo "Not yet implemented"
echo 'Not yet implemented'
return 1
;;
*)
echo "Not yet implemented!"
echo 'Not yet implemented!'
return 1
;;
esac
@ -247,14 +253,14 @@ function run_pacstrap() {
PKGS+=('de-p1st-ucode-placeholder')
;;
*)
echo "Invalid option '${CPU_VENDOR}'!"
echo 'Invalid option: '"${CPU_VENDOR}"
return 1
;;
esac
fi
local args=()
if [ "${PACSTRAP_INTERACTIVE}" = "1" ]; then
if [ "${PACSTRAP_INTERACTIVE}" = '1' ]; then
args+=('-i') # run interactively
fi
args+=('/mnt')
@ -266,17 +272,17 @@ function run_genfstab() {
# @pre
# FS
echo "Generating fstab ..."
echo 'Generating fstab ...'
local fstab
fstab="$(genfstab -U /mnt)"
case "${FS}" in
BTRFS)
# Remove "subvolid=..." mount option but leave "subvol=..." mount option
fstab=$(printf "%s" "${fstab}" | sed 's/,subvolid=[^,\s]\+//') || return $?
fstab=$(printf '%s' "${fstab}" | sed 's/,subvolid=[^,\s]\+//') || return $?
# Check if fstab does still contain subvolid mount option
if printf "%s" "${fstab}" | grep -q 'subvolid='; then
echo "This should not happen!"
if printf '%s' "${fstab}" | grep -q 'subvolid='; then
echo 'This should not happen!'
return 1
fi
;;
@ -287,12 +293,12 @@ function run_genfstab() {
true
;;
*)
echo "Filesystem $FS not yet supported!"
echo 'Filesystem '"$FS"' not yet supported!'
return 1
;;
esac
printf "%s" "${fstab}" | sudo tee /mnt/etc/fstab >/dev/null || return $?
printf '%s' "${fstab}" | sudo tee /mnt/etc/fstab >/dev/null || return $?
}
function config_hostname_and_hosts() {
@ -302,10 +308,10 @@ function config_hostname_and_hosts() {
# STATIC_IP (optional, e.g. 93.133.433.133)
# IPV6_CAPABLE (optional, e.g. 1)
echo "Set hostname ..."
echo 'Set hostname ...'
echo "${HOSTNAME}" | sudo tee /mnt/etc/hostname >/dev/null || return $?
echo "Create hosts file ..."
echo 'Create hosts file ...'
# If the system has a permanent IP address, it should be used instead of 127.0.1.1.
# * https://wiki.archlinux.org/index.php/Installation_guide#Network_configuration
@ -317,17 +323,17 @@ function config_hostname_and_hosts() {
# If STATIC_IP not given, use 127.0.1.1 instead
STATIC_IP="${STATIC_IP:='127.0.1.1'}"
echo "# The following lines are desirable for IPv4 capable hosts
echo '# The following lines are desirable for IPv4 capable hosts
127.0.0.1 localhost
# 127.0.1.1 is often used for the FQDN of the machine
${STATIC_IP} ${FQDN} ${HOSTNAME}" | sudo tee /mnt/etc/hosts >/dev/null || return $?
'"${STATIC_IP} ${FQDN} ${HOSTNAME}" | sudo tee /mnt/etc/hosts >/dev/null || return $?
if [ "${IPV6_CAPABLE}" = "1" ]; then
echo "
if [ "${IPV6_CAPABLE}" = '1' ]; then
echo '
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters" | sudo tee -a /mnt/etc/hosts >/dev/null || return $?
ff02::2 ip6-allrouters' | sudo tee -a /mnt/etc/hosts >/dev/null || return $?
fi
}
@ -337,7 +343,7 @@ function user_and_pwd() {
# USER_PWD
# ROOT_PWD (optional)
echo "Adding user and changing shell to /bin/zsh ..."
echo 'Adding user and changing shell to /bin/zsh ...'
# -m: create home
# -U: Create a group with the same name as the user, and add the user to this group.
sudo arch-chroot /mnt useradd -m -s /usr/bin/zsh -g wheel "${USERNAME}" || return $?
@ -346,8 +352,8 @@ function user_and_pwd() {
# If ROOT_PWD is not given, the use USER_PWD for root user
ROOT_PWD="${ROOT_PWD:="${USER_PWD}"}"
printf "%s:%s" "${USERNAME}" "${USER_PWD}" | sudo chpasswd --root /mnt || return $?
printf "%s:%s" "root" "${ROOT_PWD}" | sudo chpasswd --root /mnt || return $?
printf '%s:%s' "${USERNAME}" "${USER_PWD}" | sudo chpasswd --root /mnt || return $?
printf '%s:%s' "root" "${ROOT_PWD}" | sudo chpasswd --root /mnt || return $?
}
function bootloader() {
@ -355,8 +361,8 @@ function bootloader() {
# TARGET_BLOCK_DEVICE
# LUKS_PART_UUID
echo "Installing grub ..."
case "${BIOS_TYPE}" in
echo 'Installing grub ...'
case "${BOOT_FIRMWARE}" in
uefi)
# portable fallback efi name for grub:
# * https://www.rodsbooks.com/efi-bootloaders/installation.html#alternative-naming
@ -367,12 +373,12 @@ function bootloader() {
sudo arch-chroot /mnt grub-install --target=i386-pc "${TARGET_BLOCK_DEVICE}" || return $?
;;
*)
echo "Not yet implemented!"
echo 'Not yet implemented!'
return 1
;;
esac
echo "Generating /boot/grub/grub.cfg ..."
echo 'Generating /boot/grub/grub.cfg ...'
{
# /etc/default/grub is managed by Holo. Therefore we should not manually modify it.
# Instead, we create a holosript which writes $LUKS_PART_UUID into GRUB_CMDLINE_LINUX of /etc/default/grub

View File

@ -9,10 +9,10 @@ USERNAME=yoda
TARGET_BLOCK_DEVICE=/dev/sda
BOOT_PART_SIZE=500 # MiB
FS=BTRFS
FS_CHOSEN_MOUNT_OPTIONS=('noatime')
FS_ADDITIONAL_MOUNT_OPTIONS=('noatime')
CPU_VENDOR=none
BIOS_TYPE=uefi
BOOT_FIRMWARE=uefi
# If set to "1", then the data, boot and luks partitions
# will be left mounted/opened after installation

View File

@ -1,7 +1,7 @@
# Example config for testing in VirtualBox
# FQDN=domain.name.of.this.host.de
# STATIC_IP=123.456.789.012
# STATIC_IP=123.123.123.123
# IPV6_CAPABLE=1
HOSTNAME=yodaTest
USERNAME=yoda
@ -16,13 +16,13 @@ LUKS_PWD=test
TARGET_BLOCK_DEVICE=/dev/sda
BOOT_PART_SIZE=500 # MiB
FS=BTRFS
FS_CHOSEN_MOUNT_OPTIONS=('noatime')
FS_ADDITIONAL_MOUNT_OPTIONS=('noatime')
# If not booted into the target system, these values should be set:
# CPU_VENDOR: "autodetect", "amd", "intel" or "none"
CPU_VENDOR=autodetect
# BIOS_TYPE: "autodetect", "uefi" or "bios"
BIOS_TYPE=uefi
# BOOT_FIRMWARE: "autodetect", "uefi" or "bios"
BOOT_FIRMWARE=uefi
# If set to "1", then the data, boot and luks partitions
# will be left mounted/opened for manual inspection
@ -41,14 +41,6 @@ ADDITIONAL_PKGS+=('virtualbox-guest-utils')
# XFCE4 desktop with HiDPI
ADDITIONAL_PKGS+=('de-p1st-gpu-generic' 'de-p1st-xfce4-hidpi' 'de-p1st-sddm-tablet')
# Audio
## pulseaudio - base
ADDITIONAL_PKGS+=('pulseaudio' 'pulseaudio-alsa' 'pavucontrol')
## pulseaudio - xfce4
ADDITIONAL_PKGS+=('xfce4-pulseaudio-plugin')
## sound theme
ADDITIONAL_PKGS+=('libcanberra' 'libcanberra-pulse')
# If your network is unsafe, e.g. if you live in Germany, then include a VPN client
ADDITIONAL_PKGS+=('riseup-vpn')
# Smartcard (e.g. Nitrokey or Yubikey)
@ -56,7 +48,7 @@ ADDITIONAL_PKGS+=('de-p1st-smartcard')
# Other programs
ADDITIONAL_PKGS+=('signal-desktop' 'nextcloud-client' 'keepassxc' 'xournalpp' 'zotero')
ADDITIONAL_PKGS+=('firefox' 'signal-desktop' 'nextcloud-client' 'keepassxc' 'xournalpp' 'zotero')
# Development
ADDITIONAL_PKGS+=('intellij-idea-ultimate-edition' 'intellij-idea-ultimate-edition-jre')
# Document viewer

View File

@ -32,7 +32,7 @@ function get_block_devices() {
# BLOCK_DEVICES (array with one entry for each block device)
# Get list of devices, one per line
BLOCK_DEVICES="$(lsblk -dplnx size -o name | grep -Ev "boot|rpmb|loop" | tac)" || return $?
BLOCK_DEVICES="$(lsblk -dplnx size -o name | grep -Ev 'boot|rpmb|loop' | tac)" || return $?
newline_separated_to_array BLOCK_DEVICES BLOCK_DEVICES || return $?
}
@ -43,7 +43,7 @@ function get_block_devices_with_size() {
# Get list of devices and their sizes, one pair per line
# Use sed to remove multiple white spaces: sed 's|\s\s*| |'
BLOCK_DEVICE_SIZES="$(lsblk -dplnx size -o name,size | grep -Ev "boot|rpmb|loop" | sed 's|\s\s*| |' | tac)" || return $?
BLOCK_DEVICE_SIZES="$(lsblk -dplnx size -o name,size | grep -Ev 'boot|rpmb|loop' | sed 's|\s\s*| |' | tac)" || return $?
newline_to_space BLOCK_DEVICE_SIZES || return $?
space_separated_to_array BLOCK_DEVICE_SIZES BLOCK_DEVICE_SIZES || return $?
@ -53,7 +53,7 @@ function get_block_devices_with_size() {
function partition() {
# @pre
# TARGET_BLOCK_DEVICE
# BIOS_TYPE
# BOOT_FIRMWARE
# @post
# BOOT_PART
# LUKS_PART
@ -61,14 +61,14 @@ function partition() {
# if BOOT_PART_SIZE not given, set to default value
BOOT_PART_SIZE="${BOOT_PART_SIZE:='261'}"
# if too small, print warning and exit
if [ "${BOOT_PART_SIZE}" -lt "261" ]; then
echo "BOOT_PART_SIZE should be larger than 260!";
if [ "${BOOT_PART_SIZE}" -lt '261' ]; then
echo 'BOOT_PART_SIZE should be larger than 260!';
return 1;
fi
# As our data partition is encrypted,
# we need a separate boot partition!
case "${BIOS_TYPE}" in
case "${BOOT_FIRMWARE}" in
uefi)
# EFI boot partition
#
@ -101,18 +101,18 @@ function partition() {
LUKS_PART="${PARTITIONS[3]}"
;;
*)
echo "Expected uefi or bios but got ${BIOS_TYPE} instead!"
echo 'Expected uefi or bios but got '"${BOOT_FIRMWARE}"' instead!'
return 1
;;
esac
echo "boot partition: ${BOOT_PART}"
echo "luks partition: ${LUKS_PART}"
echo 'boot partition: '"${BOOT_PART}"
echo 'luks partition: '"${LUKS_PART}"
}
function format() {
# @pre
# BIOS_TYPE
# BOOT_FIRMWARE
# BOOT_PART
# LUKS_PART
# LUKS_PWD
@ -123,18 +123,18 @@ function format() {
# boot partition formatted
# luks partition formatted and opened at DATA_PART
echo "Wiping old signatures from partitions ..."
echo 'Wiping old signatures from partitions ...'
sudo wipefs "${BOOT_PART}" || return $?
sudo wipefs "${LUKS_PART}" || return $?
echo "Formatting boot partition ${BOOT_PART} ..."
echo 'Formatting boot partition '"${BOOT_PART}"' ...'
sudo mkfs.fat -F32 "${BOOT_PART}" || return $?
# Note:
# FDE: GRUB does support LUKS2 since this commit: https://git.savannah.gnu.org/cgit/grub.git/commit/?id=365e0cc3e7e44151c14dd29514c2f870b49f9755
# -> Using "--type luks1" is no longer required.
echo "Creating encrypted luks partition ${LUKS_PART} ..."
printf "%s" "${LUKS_PWD}" | sudo cryptsetup luksFormat \
echo 'Creating encrypted luks partition '"${LUKS_PART}"' ...'
printf '%s' "${LUKS_PWD}" | sudo cryptsetup luksFormat \
--cipher aes-xts-plain64 --key-size 512 --hash sha512 \
--iter-time 10000 --use-random "${LUKS_PART}" || return $?
@ -145,9 +145,9 @@ function format() {
DATA_PART="/dev/mapper/${luks_name}"
# open luks partition
printf "%s" "${LUKS_PWD}" | sudo cryptsetup luksOpen "${LUKS_PART}" "${luks_name}" || return $?
printf '%s' "${LUKS_PWD}" | sudo cryptsetup luksOpen "${LUKS_PART}" "${luks_name}" || return $?
echo "Formatting the data partition ${DATA_PART} ..."
echo 'Formatting the data partition '"${DATA_PART}"' ...'
case "${FS}" in
BTRFS)
sudo mkfs.btrfs "${DATA_PART}" || return $?
@ -163,7 +163,7 @@ function format() {
sudo mkfs.f2fs -O extra_attr,inode_checksum,sb_checksum,compression "${DATA_PART}" || return $?
;;
*)
echo "Filesystem ${FS} is not yet supported!"
echo 'Filesystem '"${FS}"' is not yet supported!'
return 1
;;
esac

View File

@ -1,4 +1,4 @@
function get_text_input {
function ask_user_if_empty {
# If variable with name $1 is zero, then ask user for input.
# Only one line user input is allowed.
# User input must not be empty.
@ -6,26 +6,26 @@ function get_text_input {
# arg $1: name of variable to store user input
# arg $2: text to display (e.g. "Enter hostname:")
if [ "$#" -ne 2 ]; then
echo "get_text_input requires two args!";
echo 'ask_user_if_empty requires two args!';
return 1
fi
for i in "$@"; do
if [ -z "$i" ]; then
echo "get_text_input: all given args must not be empty";
if [ -z "${i}" ]; then
echo 'ask_user_if_empty: all given args must not be empty';
return 1;
fi
done
local -n ptr=$1 || return $?
if [ -z "$ptr" ]; then
if [ -z "${ptr}" ]; then
# if ptr has no value yet, ask user for input!
echo "$2"
echo "${2}"
read -r ptr || return $?
fi
# check string length to be greater than zero!
if [ "${#ptr}" -lt 1 ]; then
echo "get_text_input must not be empty!";
echo 'The input must not be empty!';
return 1;
fi
}
@ -37,24 +37,24 @@ function get_single_choice {
# arg $2: text to display
# arg $3: name of variable with array of options to display (for each option there must be two entries in the array: Item and description)
if [ "$#" -ne 3 ]; then
echo "get_single_choice requires three args!";
echo 'get_single_choice requires three args!';
return 1
fi
for i in "$@"; do
if [ -z "$i" ]; then
echo "get_single_choice: all given args must not be empty";
if [ -z "${i}" ]; then
echo 'get_single_choice: all given args must not be empty';
return 1;
fi
done
local -n ptr=$1 || return $?
if [ -z "$ptr" ]; then
if [ -z "${ptr}" ]; then
# if ptr has no value yet, ask user for input!
local -n MENU_OPTIONS=$3 || return $?
ptr=$(dialog --stdout --menu "$2" 0 0 0 "${MENU_OPTIONS[@]}") || {
echo "Error during menu selection!"
ptr=$(dialog --stdout --menu "${2}" 0 0 0 "${MENU_OPTIONS[@]}") || {
echo 'Error during menu selection!'
exit 1
}
clear
@ -68,24 +68,24 @@ function get_multi_choice {
# arg $2: text to display
# arg $3: name of variable with array of options to display (for each option there must be three entries in the array: Item, description, on/off)
if [ "$#" -ne 3 ]; then
echo "get_multi_choice requires three args!";
echo 'get_multi_choice requires three args!';
return 1
fi
for i in "$@"; do
if [ -z "$i" ]; then
echo "get_multi_choice: all given args must not be empty";
if [ -z "${i}" ]; then
echo 'get_multi_choice: all given args must not be empty';
return 1;
fi
done
local -n ptr=$1 || return $?
if [ -z "$ptr" ]; then
if [ -z "${ptr}" ]; then
# if ptr has no value yet, ask user for input!
local -n MENU_OPTIONS=$3 || return $?
TMP1=$(dialog --stdout --checklist "$2" 0 0 0 "${MENU_OPTIONS[@]}") || {
echo "Error during menu selection!"
TMP1=$(dialog --stdout --checklist "${2}" 0 0 0 "${MENU_OPTIONS[@]}") || {
echo 'Error during menu selection!'
exit 1
}
clear

View File

@ -7,7 +7,7 @@ function join_by() {
local -n ptr=$2 || return $?
local -n ptr2=$3 || return $?
ptr2=$(printf ",%s" "${ptr[@]}")
ptr2=$(printf ',%s' "${ptr[@]}")
ptr2=${ptr2:1}
}
@ -36,7 +36,7 @@ function newline_separated_to_array() {
local -n ptr2=$2 || return $?
# ptr newline separated list.
# Store this as array ptr2.
readarray -t ptr2 <<<"$ptr"
readarray -t ptr2 <<<"${ptr}"
}
function space_separated_to_array() {
@ -49,7 +49,7 @@ function space_separated_to_array() {
# ptr space separated list.
# Store this as array ptr2.
# Without newline at last array element: https://unix.stackexchange.com/a/519917/315162
readarray -d " " -t ptr2 < <(printf '%s' "$ptr")
readarray -d ' ' -t ptr2 < <(printf '%s' "${ptr}")
}
function get_cpu_vendor() {
@ -58,23 +58,23 @@ function get_cpu_vendor() {
# @post
# CPU_VENDOR ("amd", "intel", "none", "")
if [[ -z "${CPU_VENDOR}" ]] || [[ "${CPU_VENDOR}" == "autodetect" ]]; then
if [[ -z "${CPU_VENDOR}" ]] || [[ "${CPU_VENDOR}" == 'autodetect' ]]; then
# If run virtual environment (e.g. VirtualBox) then no CPU microcode is required
if cat /proc/cpuinfo | grep '^flags.*hypervisor' >/dev/null; then
echo "Detected virtual environment."
CPU_VENDOR="none"
echo 'Detected virtual environment.'
CPU_VENDOR='none'
else
local vendor_id
vendor_id=$(cat /proc/cpuinfo | grep vendor_id | head -1 | sed 's|vendor_id\s*:\s*||')
if [ "$vendor_id" = "AuthenticAMD" ]; then
CPU_VENDOR="amd"
elif [ "$vendor_id" = "GenuineIntel" ]; then
CPU_VENDOR="intel"
if [ "${vendor_id}" = 'AuthenticAMD' ]; then
CPU_VENDOR='amd'
elif [ "${vendor_id}" = 'GenuineIntel' ]; then
CPU_VENDOR='intel'
else
echo "Unknown CPU vendor"
echo 'Unknown CPU vendor'
return 1
fi
fi

View File

@ -13,27 +13,27 @@ function text_input {
#
# $1: variable name to store input to
# $2: text to display (e.g. "Enter hostname:")
if [ -z "$1" ] || [ -z "$2" ]; then
echo "text_input requires two args!";
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo 'text_input requires two args!';
return 1
fi
local -n ptr=$1 || return $?
if [ -z "$ptr" ]; then
echo "$2"
if [ -z "${ptr}" ]; then
echo "${2}"
read -r ptr || return $?
fi
# check string length to be greater than zero!
if [ "${#ptr}" -lt 1 ]; then
echo "text_input must not be empty!";
echo 'text_input must not be empty!';
return 1;
fi
}
text_input foo "Enter something funny:"
echo "Input: $foo"
text_input foo 'Enter something funny:'
echo "Input: ${foo}"
bar=""
text_input bar "Enter something even funnier:"
echo "Input: $bar"
bar=''
text_input bar 'Enter something even funnier:'
echo "Input: ${bar}"

View File

@ -2,7 +2,7 @@
_pkgname=xfce4
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.0.20
pkgver=0.0.21
pkgrel=1
pkgdesc="XFCE4 with configuration"
arch=('any')
@ -52,6 +52,14 @@ depends+=(de-p1st-redshift)
# sddm themeing
depends+=(de-p1st-sddm-theme)
# ============== audio ==============
# pulseaudio - base
ADDITIONAL_PKGS+=('pulseaudio' 'pulseaudio-alsa' 'pavucontrol')
# pulseaudio - xfce4
ADDITIONAL_PKGS+=('xfce4-pulseaudio-plugin')
# sound theme
ADDITIONAL_PKGS+=('libcanberra' 'libcanberra-pulse')
# ============== network, theme, keyboard ==============
#
# NetworkManager and NetworkManager applet
@ -65,8 +73,6 @@ depends+=(de-p1st-keyboard-x11)
# ============== wallpaper ==============
depends+=(de-p1st-wallpaper)
# ============== browser ==============
depends+=(firefox)
# https://wiki.archlinux.org/title/GNOME/Keyring#Manage_using_GUI

View File

@ -1,6 +1,5 @@
Whisker Menu:
-> .face shown as user icon
-> Firefox as favourite top right
desktop-icons on primary display is set to "true"
custom destkop background

View File

@ -1,79 +0,0 @@
favorites=firefox.desktop,xfce4-mail-reader.desktop,xfce4-file-manager.desktop,xfce4-terminal-emulator.desktop
recent=firefox.desktop,xfce4-terminal-emulator.desktop
button-icon=xfce4-whiskermenu
button-single-row=false
show-button-title=false
show-button-icon=true
launcher-show-name=true
launcher-show-description=true
launcher-show-tooltip=true
item-icon-size=3
hover-switch-category=false
category-show-name=true
category-icon-size=1
load-hierarchy=false
view-as-icons=true
default-category=0
recent-items-max=10
favorites-in-recent=true
position-search-alternate=true
position-commands-alternate=false
position-categories-alternate=true
stay-on-focus-out=false
confirm-session-command=true
menu-width=450
menu-height=500
menu-opacity=100
command-settings=xfce4-settings-manager
show-command-settings=true
command-lockscreen=xflock4
show-command-lockscreen=true
command-switchuser=gdmflexiserver
show-command-switchuser=false
command-logoutuser=xfce4-session-logout --logout --fast
show-command-logoutuser=false
command-restart=xfce4-session-logout --reboot --fast
show-command-restart=false
command-shutdown=xfce4-session-logout --halt --fast
show-command-shutdown=false
command-suspend=xfce4-session-logout --suspend
show-command-suspend=false
command-hibernate=xfce4-session-logout --hibernate
show-command-hibernate=false
command-logout=xfce4-session-logout
show-command-logout=true
command-menueditor=menulibre
show-command-menueditor=true
command-profile=mugshot
show-command-profile=true
search-actions=5
[action0]
name=Man Pages
pattern=#
command=exo-open --launch TerminalEmulator man %s
regex=false
[action1]
name=Web Search
pattern=?
command=exo-open --launch WebBrowser https://duckduckgo.com/?q=%u
regex=false
[action2]
name=Wikipedia
pattern=!w
command=exo-open --launch WebBrowser https://en.wikipedia.org/wiki/%u
regex=false
[action3]
name=Run in Terminal
pattern=!
command=exo-open --launch TerminalEmulator %s
regex=false
[action4]
name=Open URI
pattern=^(file|http|https):\\/\\/(.*)$
command=exo-open \\0
regex=true

@ -1 +1 @@
Subproject commit f2d89b673b79cd9d5dbdee519a136ef23a359668
Subproject commit 4ce9106446a3046d400a9e0c80c68af5df3ca54a

@ -1 +1 @@
Subproject commit dfd3b1f887690d4d7c287a6b1d4bce0b9bfa2fa3
Subproject commit 8ba41d7f37c4eaf756da834ef8560b07f36020f9

@ -1 +1 @@
Subproject commit 5460f3800e8a13d01e5fe2d39205e277d3c767f8
Subproject commit 4d6600b719ff69ca4715445853f37cd5a2a9d859