cleanup empty lines, unify coding style

This commit is contained in:
Tobias Powalowski 2023-01-09 18:38:55 +01:00
parent 529d73d588
commit f5c392e083
11 changed files with 23 additions and 75 deletions

View file

@ -1,26 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#!/usr/bin/env bash #!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
_APPNAME="$(basename "${0}")"
_BASENAME="$(basename "${0}")"
_usage () { _usage () {
echo "${_BASENAME}: usage" echo "${_BASENAME}: usage"
echo "Check on missing binaries in archboot environment" echo "Check on missing binaries in archboot environment"
echo "-------------------------------------------------" echo "-------------------------------------------------"
echo "Usage: ${_BASENAME} <package>" echo "Usage: ${_APPNAME} <package>"
echo "This will check binaries from package, if they exist" echo "This will check binaries from package, if they exist"
echo "and report missing to binary.txt" echo "and report missing to binary.txt"
exit 0 exit 0
} }
[[ -z "${1}" ]] && _usage [[ -z "${1}" ]] && _usage
if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then
echo "This script should only be run in booted archboot environment. Aborting..." echo "This script should only be run in booted archboot environment. Aborting..."
exit 1 exit 1
fi fi
# update pacman db first # update pacman db first
pacman -Sy pacman -Sy
if [[ "${1}" == "base" ]]; then if [[ "${1}" == "base" ]]; then

View file

@ -17,14 +17,10 @@ _usage()
echo -e "usage: \033[1m${_APPNAME} <oldmountpoint> <newmountpoint>\033[0m" echo -e "usage: \033[1m${_APPNAME} <oldmountpoint> <newmountpoint>\033[0m"
exit "$1" exit "$1"
} }
################################################## ##################################################
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
_usage 1 _usage 1
fi fi
_NEWMOUNTPOINT="${2}" _NEWMOUNTPOINT="${2}"
_OLDMOUNTPOINT="${1}" _OLDMOUNTPOINT="${1}"
tar -C "${_OLDMOUNTPOINT}" -clpf - . | tar -C "${_NEWMOUNTPOINT}" -vxlspf - tar -C "${_OLDMOUNTPOINT}" -clpf - . | tar -C "${_NEWMOUNTPOINT}" -vxlspf -

View file

@ -5,7 +5,6 @@
# usage(exitvalue) # usage(exitvalue)
# outputs a usage message and exits with value # outputs a usage message and exits with value
_APPNAME=$(basename "${0}") _APPNAME=$(basename "${0}")
_usage() _usage()
{ {
echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mHWSIM:\033[0m" echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mHWSIM:\033[0m"
@ -17,11 +16,7 @@ _usage()
echo -e "usage: \033[1m${_APPNAME} <SSID>\033[0m" echo -e "usage: \033[1m${_APPNAME} <SSID>\033[0m"
exit 0 exit 0
} }
[[ -z "${1}" ]] && _usage
if [[ -z "${1}" ]]; then
_usage
fi
if ! grep -qw mac80211_hwsim /proc/modules; then if ! grep -qw mac80211_hwsim /proc/modules; then
modprobe mac80211_hwsim modprobe mac80211_hwsim
fi fi

View file

@ -3,7 +3,6 @@
_ANSWER="/tmp/.km" _ANSWER="/tmp/.km"
_TITLE="Arch Linux Console Font And Keymap Setting" _TITLE="Arch Linux Console Font And Keymap Setting"
_LIST_MAPS="localectl list-keymaps --no-pager" _LIST_MAPS="localectl list-keymaps --no-pager"
# _dialog() # _dialog()
# an el-cheapo dialog wrapper # an el-cheapo dialog wrapper
# #
@ -110,14 +109,12 @@ _mainmenu() {
: >/tmp/.keymap : >/tmp/.keymap
: >/tmp/.font : >/tmp/.font
if [[ -e /tmp/.km-running ]]; then if [[ -e /tmp/.km-running ]]; then
echo "km already runs on a different console!" echo "km already runs on a different console!"
echo "Please remove /tmp/.km-running first to launch tz!" echo "Please remove /tmp/.km-running first to launch tz!"
exit 1 exit 1
fi fi
: >/tmp/.km-running : >/tmp/.km-running
if [[ "${1}" = "--setup" ]]; then if [[ "${1}" = "--setup" ]]; then
if ! _set_vconsole; then if ! _set_vconsole; then
[[ -e /tmp/.km-running ]] && rm /tmp/.km-running [[ -e /tmp/.km-running ]] && rm /tmp/.km-running
@ -131,12 +128,9 @@ if [[ "${1}" = "--setup" ]]; then
else else
EXIT="Exit" EXIT="Exit"
fi fi
while true; do while true; do
_mainmenu _mainmenu
done done
clear clear
exit 0 exit 0
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:

View file

@ -2,10 +2,8 @@
# Copyright (c) 2015 by Roderick W. Smith # Copyright (c) 2015 by Roderick W. Smith
# Licensed under the terms of the GPL v3 # Licensed under the terms of the GPL v3
# replaced GUID with uuidgen # replaced GUID with uuidgen
echo -n "Enter a Common Name to embed in the keys: " echo -n "Enter a Common Name to embed in the keys: "
read -r NAME read -r NAME
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME PK/" -keyout PK.key \ openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME PK/" -keyout PK.key \
-out PK.crt -days 3650 -nodes -sha256 -out PK.crt -days 3650 -nodes -sha256
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME KEK/" -keyout KEK.key \ openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME KEK/" -keyout KEK.key \
@ -15,15 +13,12 @@ openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME DB/" -keyout DB.key \
openssl x509 -in PK.crt -out PK.cer -outform DER openssl x509 -in PK.crt -out PK.cer -outform DER
openssl x509 -in KEK.crt -out KEK.cer -outform DER openssl x509 -in KEK.crt -out KEK.cer -outform DER
openssl x509 -in DB.crt -out DB.cer -outform DER openssl x509 -in DB.crt -out DB.cer -outform DER
uuidgen > myGUID.txt uuidgen > myGUID.txt
cert-to-efi-sig-list -g "$GUID" PK.crt PK.esl cert-to-efi-sig-list -g "$GUID" PK.crt PK.esl
cert-to-efi-sig-list -g "$GUID" KEK.crt KEK.esl cert-to-efi-sig-list -g "$GUID" KEK.crt KEK.esl
cert-to-efi-sig-list -g "$GUID" DB.crt DB.esl cert-to-efi-sig-list -g "$GUID" DB.crt DB.esl
rm -f noPK.esl rm -f noPK.esl
touch noPK.esl touch noPK.esl
sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \ sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \
-k PK.key -c PK.crt PK PK.esl PK.auth -k PK.key -c PK.crt PK PK.esl PK.auth
sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \ sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \
@ -32,9 +27,7 @@ sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \
-k PK.key -c PK.crt KEK KEK.esl KEK.auth -k PK.key -c PK.crt KEK KEK.esl KEK.auth
sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \ sign-efi-sig-list -t "$(date --date='1 second' +'%Y-%m-%d %H:%M:%S')" \
-k KEK.key -c KEK.crt db DB.esl DB.auth -k KEK.key -c KEK.crt db DB.esl DB.auth
chmod 0600 ./*.key chmod 0600 ./*.key
echo "" echo ""
echo "" echo ""
echo "For use with KeyTool, copy the *.auth and *.esl files to a FAT USB" echo "For use with KeyTool, copy the *.auth and *.esl files to a FAT USB"

View file

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org>
_DESTDIR="${1}" _DESTDIR="${1}"
. /usr/lib/archboot/installer/common.sh . /usr/lib/archboot/installer/common.sh

View file

@ -4,22 +4,19 @@
# by Tobias Powalowski <tpowa@archlinux.org> # by Tobias Powalowski <tpowa@archlinux.org>
# usage(exitvalue) # usage(exitvalue)
# outputs a usage message and exits with value # outputs a usage message and exits with value
APPNAME=$(basename "${0}") _APPNAME=$(basename "${0}")
usage() _usage()
{ {
echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mRESTORE USB STICK:\033[0m" echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mRESTORE USB STICK:\033[0m"
echo -e "\033[1m----------------------------------------\033[0m" echo -e "\033[1m----------------------------------------\033[0m"
echo -e "This script restores an USB device to a \033[1mFAT32\033[0m device." echo -e "This script restores an USB device to a \033[1mFAT32\033[0m device."
echo -e "\033[91mWARNING: ALL DATA WILL BE LOST ON THE DEVICE! \033[0m" echo -e "\033[91mWARNING: ALL DATA WILL BE LOST ON THE DEVICE! \033[0m"
echo "" echo ""
echo -e "usage: \033[1m${APPNAME} <device>\033[0m" echo -e "usage: \033[1m${_APPNAME} <device>\033[0m"
exit "1" exit "1"
} }
################################################## ##################################################
[[ -z "${1}" ]] && _usage "$@"
[[ -z "${1}" ]] && usage "$@"
### check for root ### check for root
if ! [[ ${UID} -eq 0 ]]; then if ! [[ ${UID} -eq 0 ]]; then
echo "ERROR: Please run as root user!" echo "ERROR: Please run as root user!"

View file

@ -4,8 +4,8 @@
# by Tobias Powalowski <tpowa@archlinux.org> # by Tobias Powalowski <tpowa@archlinux.org>
# usage(exitvalue) # usage(exitvalue)
# outputs a usage message and exits with value # outputs a usage message and exits with value
APPNAME=$(basename "${0}") _APPNAME=$(basename "${0}")
usage() _usage()
{ {
echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mRSYNC BACKUP:\033[0m" echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mRSYNC BACKUP:\033[0m"
echo -e "\033[1m-----------------------------------\033[0m" echo -e "\033[1m-----------------------------------\033[0m"
@ -15,18 +15,16 @@ usage()
echo -e "- \033[1mexcluded\033[0m directories are \033[1m/dev /tmp /proc /sys /run /mnt /media /lost+found\033[0m" echo -e "- \033[1mexcluded\033[0m directories are \033[1m/dev /tmp /proc /sys /run /mnt /media /lost+found\033[0m"
echo -e "- \033[1m--numeric-ids\033[0m option is invoked to \033[1mpreserve\033[0m users" echo -e "- \033[1m--numeric-ids\033[0m option is invoked to \033[1mpreserve\033[0m users"
echo "" echo ""
echo -e "usage: \033[1m${APPNAME} <backupdir> <backupdestination>\033[0m" echo -e "usage: \033[1m${_APPNAME} <backupdir> <backupdestination>\033[0m"
exit "$1" exit "$1"
} }
################################################## ##################################################
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
usage 1 _usage 1
fi fi
_BACKUPDESTINATION="${2}"
BACKUPDESTINATION="${2}" _BACKUPDIR="${1}"
BACKUPDIR="${1}" rsync -aAXv --numeric-ids \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
rsync -aAXv --numeric-ids --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} "$BACKUPDIR" "$BACKUPDESTINATION" "${_BACKUPDIR}" "{_$BACKUPDESTINATION}"

View file

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
. /usr/lib/archboot/common.sh . /usr/lib/archboot/common.sh
usage () { usage () {
echo -e "\033[1mGenerate Secure Boot keys,MOK files and backup existing keys:\033[0m" echo -e "\033[1mGenerate Secure Boot keys,MOK files and backup existing keys:\033[0m"
echo -e "\033[1m-------------------------------------------------------------\033[0m" echo -e "\033[1m-------------------------------------------------------------\033[0m"
@ -17,11 +16,8 @@ usage () {
echo " -h This message." echo " -h This message."
exit 0 exit 0
} }
[[ -z "${1}" || -z "${2}" ]] && usage [[ -z "${1}" || -z "${2}" ]] && usage
_DIR="${2}"
_DIR="$2"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case ${1} in case ${1} in
-name=*|--name=*) NAME="$(echo "${1}" | awk -F= '{print $2;}')" ;; -name=*|--name=*) NAME="$(echo "${1}" | awk -F= '{print $2;}')" ;;
@ -29,21 +25,17 @@ while [ $# -gt 0 ]; do
esac esac
shift shift
done done
if [[ -z "${NAME}" ]]; then if [[ -z "${NAME}" ]]; then
echo "ERROR: no name specified" echo "ERROR: no name specified"
usage usage
#shellcheck disable=2317 #shellcheck disable=2317
exit 1 exit 1
fi fi
_root_check _root_check
# archboot # archboot
[[ -e /usr/bin/mkkeys.sh ]] && MKKEYS="mkkeys.sh" [[ -e /usr/bin/mkkeys.sh ]] && MKKEYS="mkkeys.sh"
# normal system # normal system
[[ -e /usr/bin/archboot-mkkeys.sh ]] && MKKEYS="archboot-mkkeys.sh" [[ -e /usr/bin/archboot-mkkeys.sh ]] && MKKEYS="archboot-mkkeys.sh"
if [[ -n "${_DIR}" ]]; then if [[ -n "${_DIR}" ]]; then
[[ ! -d "${_DIR}" ]] && mkdir -p "${_DIR}" [[ ! -d "${_DIR}" ]] && mkdir -p "${_DIR}"
cd "${_DIR}" || exit 1 cd "${_DIR}" || exit 1

View file

@ -2,13 +2,6 @@
# written by Tobias Powalowski <tpowa@archlinux.org> # written by Tobias Powalowski <tpowa@archlinux.org>
_ANSWER="/tmp/.tz" _ANSWER="/tmp/.tz"
_TITLE="Arch Linux Time And Date Setting" _TITLE="Arch Linux Time And Date Setting"
if [[ "${1}" = "--setup" ]]; then
_EXIT="Return to Main Menu"
else
_EXIT="Exit"
fi
# _dialog() # _dialog()
# an el-cheapo dialog wrapper # an el-cheapo dialog wrapper
# #
@ -160,11 +153,14 @@ _mainmenu() {
_abort ;; _abort ;;
esac esac
} }
: >/tmp/.hardwareclock : >/tmp/.hardwareclock
: >/tmp/.timezone : >/tmp/.timezone
: >/tmp/.tz : >/tmp/.tz
if [[ "${1}" = "--setup" ]]; then
_EXIT="Return to Main Menu"
else
_EXIT="Exit"
fi
if [[ -e /tmp/.tz-running ]]; then if [[ -e /tmp/.tz-running ]]; then
echo "tz already runs on a different console!" echo "tz already runs on a different console!"
echo "Please remove /tmp/.tz-running first to launch tz!" echo "Please remove /tmp/.tz-running first to launch tz!"
@ -178,5 +174,4 @@ done
clear clear
exit 0 exit 0
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:

View file

@ -10,9 +10,7 @@
. /usr/lib/archboot/update-installer/gnome-wayland.sh . /usr/lib/archboot/update-installer/gnome-wayland.sh
. /usr/lib/archboot/update-installer/plasma.sh . /usr/lib/archboot/update-installer/plasma.sh
. /usr/lib/archboot/update-installer/plasma-wayland.sh . /usr/lib/archboot/update-installer/plasma-wayland.sh
[[ -z "${1}" ]] && usage [[ -z "${1}" ]] && usage
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case ${1} in case ${1} in
-u|--u) _D_SCRIPTS="1" ;; -u|--u) _D_SCRIPTS="1" ;;
@ -32,7 +30,6 @@ while [ $# -gt 0 ]; do
esac esac
shift shift
done done
_archboot_check _archboot_check
_download_latest _download_latest
echo -e "\033[1mInformation:\033[0m Logging is done on \033[1m/dev/tty7\033[0m ..." echo -e "\033[1mInformation:\033[0m Logging is done on \033[1m/dev/tty7\033[0m ..."
@ -41,17 +38,14 @@ _zram_initialize
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]]; then if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]]; then
_new_environment _new_environment
fi fi
# Generate new images # Generate new images
if [[ -n "${_G_RELEASE}" ]]; then if [[ -n "${_G_RELEASE}" ]]; then
_new_image _new_image
fi fi
# install custom xorg or wayland # install custom xorg or wayland
if [[ -n "${_CUSTOM_X}" || -n "${_CUSTOM_WAYLAND}" ]]; then if [[ -n "${_CUSTOM_X}" || -n "${_CUSTOM_WAYLAND}" ]]; then
_custom_wayland_xorg _custom_wayland_xorg
fi fi
# Gnome, KDE/PLASMA or XFCE launch # Gnome, KDE/PLASMA or XFCE launch
if [[ -n "${_L_XFCE}" || -n "${_L_PLASMA}" || -n "${_L_GNOME}" || -n "${_L_GNOME_WAYLAND}" || -n "${_L_PLASMA_WAYLAND}" ]]; then if [[ -n "${_L_XFCE}" || -n "${_L_PLASMA}" || -n "${_L_GNOME}" || -n "${_L_GNOME_WAYLAND}" || -n "${_L_PLASMA_WAYLAND}" ]]; then
if [[ -e "/.graphic_installed" && "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -lt 4413000 ]]; then if [[ -e "/.graphic_installed" && "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -lt 4413000 ]]; then
@ -60,9 +54,7 @@ if [[ -n "${_L_XFCE}" || -n "${_L_PLASMA}" || -n "${_L_GNOME}" || -n "${_L_GNOME
_install_graphic _install_graphic
fi fi
fi fi
# Switch to full Arch Linux system # Switch to full Arch Linux system
if [[ -n "${_FULL_SYSTEM}" ]]; then if [[ -n "${_FULL_SYSTEM}" ]]; then
_full_system _full_system
fi fi