install.sh: Fix weird naming

This commit is contained in:
2024-04-22 14:02:56 +02:00
parent cf98ddc251
commit 00d68fdcb8

View File

@@ -17,10 +17,10 @@ if [[ ! -e "${os_release_file}" ]] ; then
exit 1 exit 1
fi fi
source /etc/os-release source "${os_release_file}"
sudowrap() { sudowrap() {
if (( $(id -u ) != 0 )) ; then if (( $(id -u) != 0 )) ; then
sudo "${@}" sudo "${@}"
else else
"${@}" "${@}"
@@ -28,14 +28,15 @@ sudowrap() {
} }
cache_updated=0 cache_updated=0
_install() { install() {
_package="$1" ; shift local package="$1" ; shift
if [[ $NAME == "Arch Linux" ]] ; then if [[ $NAME == "Arch Linux" ]] ; then
if (( ! cache_updated )) ; then if (( ! cache_updated )) ; then
sudowrap pacman -Sy sudowrap pacman -Sy
cache_updated=1 cache_updated=1
fi fi
sudowrap pacman -S --needed --noconfirm "${_package}" sudowrap pacman -S --needed --noconfirm "${package}"
else else
2>&1 printf "Unsupported distro $NAME, exiting" 2>&1 printf "Unsupported distro $NAME, exiting"
exit 1 exit 1
@@ -44,24 +45,26 @@ _install() {
if ! command -v git >/dev/null ; then if ! command -v git >/dev/null ; then
printf 'Git not installed, installing ...\n' printf 'Git not installed, installing ...\n'
_install "git" install "git"
printf 'Done\n' printf 'Done\n'
fi fi
if ! command -v python3 >/dev/null ; then if ! command -v python3 >/dev/null ; then
printf 'Python3 not installed, installing ...\n' printf 'Python3 not installed, installing ...\n'
_install "python3" install "python3"
printf 'Done\n' printf 'Done\n'
fi fi
if ! command -v make >/dev/null ; then if ! command -v make >/dev/null ; then
printf 'Make not installed, installing ...\n' printf 'Make not installed, installing ...\n'
_install "make" install "make"
printf 'Done\n' printf 'Done\n'
fi fi
if [[ $NAME == "Arch Linux" ]] ; then if ! command -v ansible >/dev/null ; then
_install "ansible" printf 'Ansible not installed, installing ...\n'
install "ansible"
printf 'Done\n'
fi fi
[[ -e './.git' ]] && git submodule update --init [[ -e './.git' ]] && git submodule update --init
@@ -84,4 +87,4 @@ fi
cd "${DOTDIR}" cd "${DOTDIR}"
cd "$DOTDIR" && make cd "${DOTDIR}" && make