From 603d58e00b1f9dafe79ec946ea284fbdc53c48f5 Mon Sep 17 00:00:00 2001 From: Yigid BALABAN Date: Sun, 25 Aug 2024 01:32:14 +0300 Subject: [PATCH] M change install directory M better UX + add to path per shell --- install.sh | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 94c2147..2ad076b 100644 --- a/install.sh +++ b/install.sh @@ -3,24 +3,57 @@ # reve desktop environment framework # Yigid BALABAN 2024 -rt_script_dir=$(realpath "$(dirname $0)") -cd "$rt_script_dir" +rt_script_dir=$(realpath "$(dirname "$0")") +cd "$rt_script_dir" || exit -reve_installation_target="$HOME/.local/reve" +reve_installation_target="$HOME/.local/bin/reve" -echo "Creating reve installation folder" +echo "[1/5] Creating reve installation folder" mkdir -p "$reve_installation_target" -echo "Copying: reve.sh" +echo "[2/5] Copying: reve.sh and _reve.sh" cp reve.sh "$reve_installation_target/reve" +cp _reve.sh "$reve_installation_target/_reve" chmod +x "$reve_installation_target/reve" +chmod -x "$reve_installation_target/_reve" -echo "Creating chores/mode folder" +echo "[3/5] Adding reve to path" +if grep -q "/bin/bash" /etc/shells; then + echo "==> bash detected." + if ! grep -q "$reve_installation_target" ~/.bashrc; then + echo "export PATH=\"\$PATH:$reve_installation_target\"" >> ~/.bashrc + echo "Added $reve_installation_target to bash PATH." + else + echo "$reve_installation_target is already in bash PATH." + fi +fi + +if grep -q "/bin/zsh" /etc/shells; then + echo "==> zsh detected." + if ! grep -q "$reve_installation_target" ~/.zshrc; then + echo "export PATH=\"\$PATH:$reve_installation_target\"" >> ~/.zshrc + echo "Added $reve_installation_target to zsh PATH." + else + echo "$reve_installation_target is already in zsh PATH." + fi +fi + +if grep -q "/bin/fish" /etc/shells; then + echo "==> fish detected." + if ! fish -c "echo $PATH | grep -q $reve_installation_target"; then + fish -c "fish_add_path $reve_installation_target" + echo "Added $reve_installation_target to fish PATH." + else + echo "$reve_installation_target is already in fish PATH." + fi +fi + +echo "[4/5] Creating chores/mode folder" mkdir -p "$reve_installation_target/chores/mode" -echo "Copying chore: gtk_theme.sh" +echo "[5/5] Copying chore: gtk_theme.sh" cp chores/mode/gtk_theme.sh "$reve_installation_target/chores/mode/gtk_theme.sh" chmod +x "$reve_installation_target/chores/mode/gtk_theme.sh" -echo "Base installation completed. You can copy remaining default chores from chores/mode at will or create your own chores following the examples in examples folder. +echo "🎉 Base installation completed. You can copy remaining default chores from chores/mode at will or create your own chores following the examples in examples folder." exit 0