Priv check & home directory
This commit is contained in:
parent
35428bea93
commit
16bf930901
1 changed files with 20 additions and 5 deletions
25
install.sh
25
install.sh
|
|
@ -82,6 +82,21 @@ function getFlatpak {
|
|||
displayCmd "flatpak install -y $1" "Installing (flatpak) $1"
|
||||
}
|
||||
|
||||
# --- Priv Check ---
|
||||
if [ $EUID -ne 0 ]; then
|
||||
displayTitle "FATAL ERROR"
|
||||
echo -e "Please run the script with $(styleColor "cyan")\`sudo\`$(styleColorRst) or login as $(styleColor "cyan")root$(styleColorRst).\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
# --- Variables ---
|
||||
HOMEDIR=""
|
||||
if [ -n "$SUDO_USER" ]; then
|
||||
HOMEDIR="/home/${SUDO_USER}"
|
||||
else
|
||||
HOMEDIR="$HOME"
|
||||
fi
|
||||
|
||||
# --- Entry Point ---
|
||||
displayTitle "OBJNULL Dotfile Installer"
|
||||
|
||||
|
|
@ -120,8 +135,8 @@ getPackage "yazi helix lazygit iamb"
|
|||
|
||||
# --- Configurations ---
|
||||
displayTitle "Configurations"
|
||||
displayCmd "mkdir ~/.config" "Creating config directory"
|
||||
displayCmd "cp -r .config ${PWD}/.config" "Installing configs"
|
||||
displayCmd "cp .bashrc ${PWD}/.bashrc" "Installing bash profile"
|
||||
displayCmd "cp -r Pictures ${PWD}/Pictures" "Installing pictures"
|
||||
displayCmd "cp -r /etc/xdg/quickshell ${PWD}/.config/." "Installing quickshell config"
|
||||
displayCmd "mkdir ${HOMEDIR}/.config" "Creating config directory"
|
||||
displayCmd "cp -r .config ${HOMEDIR}/.config" "Installing configs"
|
||||
displayCmd "cp .bashrc ${HOMEDIR}/.bashrc" "Installing bash profile"
|
||||
displayCmd "cp -r Pictures ${HOMEDIR}/Pictures" "Installing pictures"
|
||||
displayCmd "cp -r /etc/xdg/quickshell ${HOMEDIR}/.config/." "Installing quickshell config"
|
||||
|
|
|
|||
Loading…
Reference in a new issue