coding unifying

This commit is contained in:
Tobias Powalowski 2023-01-09 18:28:06 +01:00
parent 09f1842692
commit 529d73d588
3 changed files with 18 additions and 18 deletions

View file

@ -4,7 +4,7 @@
_BASENAME="$(basename "${0}")"
usage () {
_usage () {
echo "${_BASENAME}: usage"
echo "Check on missing binaries in archboot environment"
echo "-------------------------------------------------"
@ -14,7 +14,7 @@ usage () {
exit 0
}
[[ -z "${1}" ]] && usage
[[ -z "${1}" ]] && _usage
if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then
echo "This script should only be run in booted archboot environment. Aborting..."
@ -24,12 +24,12 @@ fi
# update pacman db first
pacman -Sy
if [[ "${1}" == "base" ]]; then
PACKAGE="$(pacman -Qi base | grep Depends | cut -d ":" -f2)"
_PACKAGE="$(pacman -Qi base | grep Depends | cut -d ":" -f2)"
else
PACKAGE="${1}"
_PACKAGE="${1}"
fi
echo "${PACKAGE}" >binary.txt
echo "${_PACKAGE}" >binary.txt
#shellcheck disable=SC2086
for i in $(pacman -Ql ${PACKAGE} | grep "/usr/bin/..*"$ | cut -d' ' -f2); do
for i in $(pacman -Ql ${_PACKAGE} | grep "/usr/bin/..*"$ | cut -d' ' -f2); do
command -v "${i}" >/dev/null 2>&1 || echo "${i}" >>binary.txt
done

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[1mCOPY MOUNTPOINTS:\033[0m"
echo -e "\033[1m---------------------------------------\033[0m"
@ -14,17 +14,17 @@ usage()
echo -e "- For system copying start with mounted \033[1m/\033[0m and then invoke this script"
echo -e " for each additional mountpoint eg. \033[1m/boot\033[0m or \033[1m/home\033[0m."
echo ""
echo -e "usage: \033[1m${APPNAME} <oldmountpoint> <newmountpoint>\033[0m"
echo -e "usage: \033[1m${_APPNAME} <oldmountpoint> <newmountpoint>\033[0m"
exit "$1"
}
##################################################
if [ $# -ne 2 ]; then
usage 1
_usage 1
fi
NEWMOUNTPOINT="${2}"
OLDMOUNTPOINT="${1}"
_NEWMOUNTPOINT="${2}"
_OLDMOUNTPOINT="${1}"
tar -C "$OLDMOUNTPOINT" -clpf - . | tar -C "$NEWMOUNTPOINT" -vxlspf -
tar -C "${_OLDMOUNTPOINT}" -clpf - . | tar -C "${_NEWMOUNTPOINT}" -vxlspf -

View file

@ -4,9 +4,9 @@
# by Tobias Powalowski <tpowa@archlinux.org>
# usage(exitvalue)
# 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[1m---------------------------------------\033[0m"
@ -14,12 +14,12 @@ usage()
echo "with mac80211_hwsim module."
echo "- wlan0 will be setup as the AP. Don't use for scanning!"
echo "- wlan1 will be setup for STATION mode. Use this for scanning for your AP."
echo -e "usage: \033[1m${APPNAME} <SSID>\033[0m"
echo -e "usage: \033[1m${_APPNAME} <SSID>\033[0m"
exit 0
}
if [[ -z "${1}" ]]; then
usage
_usage
fi
if ! grep -qw mac80211_hwsim /proc/modules; then
@ -30,4 +30,4 @@ systemctl restart iwd
sleep 2
iwctl device wlan0 set-property Mode ap
iwctl device wlan0 set-property Powered on
iwctl ap wlan0 start "$1" "12345678" && echo -e "\033[1mSSID:'$1' with password '12345678' is online now.\033[0m"
iwctl ap wlan0 start "${1}" "12345678" && echo -e "\033[1mSSID:'${1}' with password '12345678' is online now.\033[0m"