aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2020-07-19 13:00:41 -0500
committerJesús <heckyel@hyperbola.info>2020-07-19 13:00:41 -0500
commitd3b45cf5877e6ea8e6f7e3e6e1c5593cc566a249 (patch)
tree2531981394bf3dd381bf4552110c66366ce38f4a
parent4746a1e6e011b292dee5ea2248aa7ec6ad0b32c3 (diff)
downloadi3-config-d3b45cf5877e6ea8e6f7e3e6e1c5593cc566a249.tar.lz
i3-config-d3b45cf5877e6ea8e6f7e3e6e1c5593cc566a249.tar.xz
i3-config-d3b45cf5877e6ea8e6f7e3e6e1c5593cc566a249.zip
check root privileges
-rw-r--r--install.sh35
1 files changed, 23 insertions, 12 deletions
diff --git a/install.sh b/install.sh
index f0579c6..a63fafb 100644
--- a/install.sh
+++ b/install.sh
@@ -2,28 +2,39 @@
URL="https://libregit.org/heckyel/i3-config.git"
+function _check_root() {
+ if [[ "$UID" == 0 ]]; then
+ root_key=''
+ elif [[ $(command -v sudo) ]]; then
+ root_key=sudo
+ elif [[ $(command -v doas) ]]; then
+ root_key=doas
+ fi
+ return $root_key
+}
+
while true
do
function _copy_i3_config() {
## Install dependencies
if [[ $(command -v pacman) ]]; then
- sudo pacman -Syy
+ _check_root pacman -Syy
# i3 base
- sudo pacman -S i3-wm i3status dmenu sysstat
+ _check_root pacman -S i3-wm i3status dmenu sysstat
# i3 blocks and dependecies
- sudo pacman -S i3blocks i3lock rofi termite \
- conky playerctl acpi scrot xfce4-terminal \
- thunar tumbler feh ranger \
- ttf-hack ttf-bitstream-vera
+ _check_root pacman -S i3blocks i3lock rofi termite \
+ conky playerctl acpi scrot xfce4-terminal \
+ thunar tumbler feh ranger \
+ ttf-hack ttf-bitstream-vera
elif [[ $(command -v apt-get) ]]; then
- sudo apt update
+ _check_root apt update
# i3 base
- sudo apt install i3-wm i3status suckless-tools sysstat
+ _check_root apt install i3-wm i3status suckless-tools sysstat
# i3 blocks and dependecies
- sudo apt install i3blocks i3lock rofi termite \
- conky playerctl acpi network-manager-gnome scrot \
- xfce4-terminal thunar tumbler feh ranger \
- fonts-hack-ttf ttf-bitstream-vera
+ _check_root apt install i3blocks i3lock rofi termite \
+ conky playerctl acpi network-manager-gnome scrot \
+ xfce4-terminal thunar tumbler feh ranger \
+ fonts-hack-ttf ttf-bitstream-vera
fi
# Install i3config