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

View file

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

View file

@ -5,7 +5,6 @@
# usage(exitvalue)
# outputs a usage message and exits with value
_APPNAME=$(basename "${0}")
_usage()
{
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"
exit 0
}
if [[ -z "${1}" ]]; then
_usage
fi
[[ -z "${1}" ]] && _usage
if ! grep -qw mac80211_hwsim /proc/modules; then
modprobe mac80211_hwsim
fi

View file

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

View file

@ -2,10 +2,8 @@
# Copyright (c) 2015 by Roderick W. Smith
# Licensed under the terms of the GPL v3
# replaced GUID with uuidgen
echo -n "Enter a Common Name to embed in the keys: "
read -r NAME
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=$NAME PK/" -keyout PK.key \
-out PK.crt -days 3650 -nodes -sha256
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 KEK.crt -out KEK.cer -outform DER
openssl x509 -in DB.crt -out DB.cer -outform DER
uuidgen > myGUID.txt
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" DB.crt DB.esl
rm -f noPK.esl
touch noPK.esl
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
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
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
chmod 0600 ./*.key
echo ""
echo ""
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
# created by Tobias Powalowski <tpowa@archlinux.org>
_DESTDIR="${1}"
. /usr/lib/archboot/installer/common.sh

View file

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

View file

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

View file

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

View file

@ -2,13 +2,6 @@
# written by Tobias Powalowski <tpowa@archlinux.org>
_ANSWER="/tmp/.tz"
_TITLE="Arch Linux Time And Date Setting"
if [[ "${1}" = "--setup" ]]; then
_EXIT="Return to Main Menu"
else
_EXIT="Exit"
fi
# _dialog()
# an el-cheapo dialog wrapper
#
@ -160,11 +153,14 @@ _mainmenu() {
_abort ;;
esac
}
: >/tmp/.hardwareclock
: >/tmp/.timezone
: >/tmp/.tz
if [[ "${1}" = "--setup" ]]; then
_EXIT="Return to Main Menu"
else
_EXIT="Exit"
fi
if [[ -e /tmp/.tz-running ]]; then
echo "tz already runs on a different console!"
echo "Please remove /tmp/.tz-running first to launch tz!"
@ -178,5 +174,4 @@ done
clear
exit 0
# 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/plasma.sh
. /usr/lib/archboot/update-installer/plasma-wayland.sh
[[ -z "${1}" ]] && usage
while [ $# -gt 0 ]; do
case ${1} in
-u|--u) _D_SCRIPTS="1" ;;
@ -32,7 +30,6 @@ while [ $# -gt 0 ]; do
esac
shift
done
_archboot_check
_download_latest
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
_new_environment
fi
# Generate new images
if [[ -n "${_G_RELEASE}" ]]; then
_new_image
fi
# install custom xorg or wayland
if [[ -n "${_CUSTOM_X}" || -n "${_CUSTOM_WAYLAND}" ]]; then
_custom_wayland_xorg
fi
# 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 [[ -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
fi
fi
# Switch to full Arch Linux system
if [[ -n "${_FULL_SYSTEM}" ]]; then
_full_system
fi