Run with sudo if not root
This commit is contained in:
parent
e48dcf8b55
commit
c74d9b1a5b
61
install.sh
61
install.sh
|
@ -1,16 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Headless
|
# Headless
|
||||||
NVIM=true
|
NVIM=false
|
||||||
ZSH=true
|
ZSH=false
|
||||||
PROFILE=true
|
PROFILE=false
|
||||||
TMUX=true
|
TMUX=false
|
||||||
|
|
||||||
# GUI
|
# GUI
|
||||||
AWESOME=false
|
AWESOME=false
|
||||||
ALACRITTY=false
|
ALACRITTY=false
|
||||||
MPV=false
|
MPV=false
|
||||||
|
|
||||||
|
SUDO="sudo"
|
||||||
|
|
||||||
|
if [[ $(whoami) == "root" ]]; then
|
||||||
|
SUDO=""
|
||||||
|
fi
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# Basic Preparation #
|
# Basic Preparation #
|
||||||
|
@ -34,13 +39,13 @@ fi
|
||||||
if $NVIM; then
|
if $NVIM; then
|
||||||
dependencies="neovim git npm unzip fzf cmake gcc make curl wget"
|
dependencies="neovim git npm unzip fzf cmake gcc make curl wget"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies
|
$SUDO pacman -Sy --needed --noconfirm $dependencies
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y software-properties-common
|
$SUDO apt install -y software-properties-common
|
||||||
add-apt-repository ppa:neovim-ppa/unstable -y
|
$SUDO add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies python-venv
|
$SUDO apt install -y $dependencies
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/nvim $XDG_CONFIG_HOME/nvim
|
ln -s $PWD/nvim $XDG_CONFIG_HOME/nvim
|
||||||
|
@ -56,11 +61,11 @@ if $ZSH; then
|
||||||
PROFILE=true
|
PROFILE=true
|
||||||
dependencies="fzf zsh curl"
|
dependencies="fzf zsh curl"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies
|
$SUDO pacman -Sy --needed --noconfirm $dependencies
|
||||||
echo "Please manually install yay and autojump-rs"
|
echo "Please manually install yay and autojump-rs"
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies autojump
|
$SUDO apt install -y $dependencies autojump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/zsh $XDG_CONFIG_HOME/zsh
|
ln -s $PWD/zsh $XDG_CONFIG_HOME/zsh
|
||||||
|
@ -84,10 +89,10 @@ fi
|
||||||
if $AWESOME; then
|
if $AWESOME; then
|
||||||
dependencies="awesome picom numlockx xcape rofi"
|
dependencies="awesome picom numlockx xcape rofi"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies network-manager-applet xorg-xmodmap adobe-source-code-pro-fonts noto-fonts ttf-nerd-fonts-symbols
|
$SUDO pacman -Sy --needed --noconfirm $dependencies network-manager-applet xorg-xmodmap adobe-source-code-pro-fonts noto-fonts ttf-nerd-fonts-symbols
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies awesome-extra
|
$SUDO apt install -y $dependencies awesome-extra
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/awesome $XDG_CONFIG_HOME/awesome
|
ln -s $PWD/awesome $XDG_CONFIG_HOME/awesome
|
||||||
|
@ -103,13 +108,13 @@ fi
|
||||||
if $ALACRITTY; then
|
if $ALACRITTY; then
|
||||||
dependencies="alacritty"
|
dependencies="alacritty"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies
|
$SUDO pacman -Sy --needed --noconfirm $dependencies
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y software-properties-common
|
$SUDO apt install -y software-properties-common
|
||||||
add-apt-repository ppa:aslatter/ppa -y
|
$SUDO add-apt-repository ppa:aslatter/ppa -y
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies
|
$SUDO apt install -y $dependencies
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/alacritty $XDG_CONFIG_HOME/alacritty
|
ln -s $PWD/alacritty $XDG_CONFIG_HOME/alacritty
|
||||||
|
@ -122,10 +127,10 @@ fi
|
||||||
if $MPV; then
|
if $MPV; then
|
||||||
dependencies="mpv"
|
dependencies="mpv"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies
|
$SUDO pacman -Sy --needed --noconfirm $dependencies
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies
|
$SUDO apt install -y $dependencies
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/mpv $XDG_CONFIG_HOME/mpv
|
ln -s $PWD/mpv $XDG_CONFIG_HOME/mpv
|
||||||
|
@ -138,10 +143,10 @@ fi
|
||||||
if $TMUX; then
|
if $TMUX; then
|
||||||
dependencies="tmux git zsh xdg-utils"
|
dependencies="tmux git zsh xdg-utils"
|
||||||
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
|
||||||
pacman -Sy --needed --noconfirm $dependencies
|
$SUDO pacman -Sy --needed --noconfirm $dependencies
|
||||||
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
|
||||||
apt update
|
$SUDO apt update
|
||||||
apt install -y $dependencies
|
$SUDO apt install -y $dependencies
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $PWD/tmux $XDG_CONFIG_HOME/tmux
|
ln -s $PWD/tmux $XDG_CONFIG_HOME/tmux
|
||||||
|
|
Loading…
Reference in New Issue