This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/os/linux/arch/provision.sh
2022-07-19 10:01:14 -05:00

25 lines
468 B
Bash
Executable file

#!/usr/bin/env sh
pacman -Syy
pacman -S --noconfirm --needed fish sudo
is_root="$(test "$(whoami)" == 'root' && echo "1" || echo "0")"
ls -la "$(dirname "$0")"
for file in "$(dirname "$0")/provision.d"/*; do
test -d "$file" && continue
echo "Runnning $file..."
if grep -q "AS_ROOT" "$file"; then
if [ "$is_root" = "1" ]; then
"$file"
else
sudo "$file"
fi
else
if [ "$is_root" = "1" ]; then
sudo -u daniel "$file"
else
"$file"
fi
fi
done