diff --git a/05-config-usrland.sh b/05-config-usrland.sh index 8cb4d4b..8068287 100755 --- a/05-config-usrland.sh +++ b/05-config-usrland.sh @@ -1,5 +1,7 @@ #!/bin/bash +DEFAULT_USR_FOLDER="/usr/share/debian-gaming/home" + if [ "$(id -u)" -ne 0 ]; then echo "❌ The Skript has to be run as root!" exit 1 @@ -10,13 +12,15 @@ mkdir -p /etc/profile.d cp ./data/etc/profile.d/* /etc/profile.d/ # Copy Zsh-Files -mkdir -p $HOME/oh-my-zsh/themes -cp ./data/home/zshrc $HOME/zshrc +cp ./data/home/zshrc $DEFAULT_USR_FOLDER/zshrc grep -q '^source /etc/profile' /etc/zsh/zprofile || echo 'source /etc/profile' >> /etc/zsh/zprofile +# copy config folder +cp -r $HOME/.config $DEFAULT_USR_FOLDER/config + # copy templates -cp -r ./data/home/templates $HOME/templates +cp -r ./data/home/templates $DEFAULT_USR_FOLDER/templates # set zsh as default shell USER_ENTRY=$(getent passwd "$USER") diff --git a/data/etc/profile.d/copy_user_config.sh b/data/etc/profile.d/copy_user_config.sh index c114f4e..abed478 100755 --- a/data/etc/profile.d/copy_user_config.sh +++ b/data/etc/profile.d/copy_user_config.sh @@ -9,27 +9,25 @@ CHECK_FILE="$HOME/.config/.debian_gaming_configs_copied" TEMPLATES_DIR=$(xdg-user-dir TEMPLATES 2>/dev/null || echo "$HOME/Templates") if [ ! -e "$CHECK_FILE" ]; then - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + if [ -d "$DEFAULT_USR_FOLDER" ]; then + + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + + if [ -e "$HOME/.config" ]; then + mv $HOME/.config $HOME/.config.bak + fi + + if [ -e "$HOME/.zshrc" ]; then + mv $HOME/.zshrc $HOME/.zshrc.bak + fi + + mkdir -p $HOME/.config + + cp -r $DEFAULT_USR_FOLDER/config/* $HOME/.config + cp -r $DEFAULT_USR_FOLDER/templates/* $TEMPLATES_DIR + cp $DEFAULT_USR_FOLDER/zshrc $HOME/.zshrc + + touch $CHECK_FILE - if [ -e "$HOME/.oh-my-zsh/themes" ]; then - mv $HOME/.oh-my-zsh/themes $HOME/.oh-my-zsh/.themes.bak fi - - if [ -e "$HOME/.config" ]; then - mv $HOME/.config $HOME/.config.bak - fi - - if [ -e "$HOME/.zshrc" ]; then - mv $HOME/.zshrc $HOME/.zshrc.bak - fi - - mkdir -p $HOME/.oh-my-zsh/themes - mkdir -p $HOME/.config - - cp -r $DEFAULT_USR_FOLDER/config/* $HOME/.config - cp -r $DEFAULT_USR_FOLDER/oh-my-zsh/themes/* $HOME/.oh-my-zsh/themes - cp -r $DEFAULT_USR_FOLDER/templates/* $TEMPLATES_DIR - cp $DEFAULT_USR_FOLDER/zshrc $HOME/.zshrc - - touch $CHECK_FILE fi