diff --git a/.backup/run.sh b/.backup/run.sh index 8b7e4ec..b93180d 100644 --- a/.backup/run.sh +++ b/.backup/run.sh @@ -1,36 +1,52 @@ #!/bin/bash -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.psensor ../linux/.psensor -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.p10k.zsh ../.p10k.zsh -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.zshrc ../.zshrc - -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/bleachbit ../linux/.config/bleachbit -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/autostart ../linux/.config/autostart -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/compton ../linux/.config/compton -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/nautilus ../linux/.config/nautilus -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/terminator ../linux/.config/terminator -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/ulauncher ../linux/.config/ulauncher -cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/Dharkael ../linux/.config/Dharkael - -# shellcheck disable=SC1091 -if [ -f "/etc/os-release" ]; then - . /etc/os-release - OS=$NAME - - if [ "$OS" == "Ubuntu" ]; then - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/dconf ../ubuntu/.config/dconf - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/mimeapps.list ../ubuntu/.config/mimeapps.list - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/gnome-shell ../ubuntu/.config/gnome-shell - - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.local/share/sounds ../ubuntu/.local/share/sounds - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.local/share/grilo-plugins ../ubuntu/.local/share/grilo-plugins - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.local/share/gnome-shell ../ubuntu/.local/share/gnome-shell - - elif [ "$OS" == "Zorin OS" ]; then - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/dconf ../zorin/.config/dconf - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.config/mimeapps.list ../zorin/.config/mimeapps.list - - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.local/share/sounds ../zorin/.local/share/sounds - cp -TRv "${ZSH_CUSTOM:-$HOME}"/.local/share/gnome-shell ../zorin/.local/share/gnome-shell +OS=$(uname -s) + +case "$OS" in + "Darwin") + echo "Running on MacOS" + ;; + "Linux") + # shellcheck disable=SC1091 + if [ -f "/etc/os-release" ]; then + . /etc/os-release + echo "Running on $NAME" + + cp -TRv "${HOME}"/.p10k.zsh ../.p10k.zsh + cp -TRv "${HOME}"/.zshrc ../.zshrc + + cp -TRv "${HOME}"/.psensor ../linux/.psensor + cp -TRv "${HOME}"/.config/bleachbit ../linux/.config/bleachbit + cp -TRv "${HOME}"/.config/autostart ../linux/.config/autostart + cp -TRv "${HOME}"/.config/compton ../linux/.config/compton + cp -TRv "${HOME}"/.config/nautilus ../linux/.config/nautilus + cp -TRv "${HOME}"/.config/terminator ../linux/.config/terminator + cp -TRv "${HOME}"/.config/ulauncher ../linux/.config/ulauncher + cp -TRv "${HOME}"/.config/Dharkael ../linux/.config/Dharkael + + if [ "$NAME" == "Ubuntu" ]; then + cp -TRv "${HOME}"/.config/dconf ../ubuntu/.config/dconf + cp -TRv "${HOME}"/.config/mimeapps.list ../ubuntu/.config/mimeapps.list + cp -TRv "${HOME}"/.config/gnome-shell ../ubuntu/.config/gnome-shell + + cp -TRv "${HOME}"/.local/share/sounds ../ubuntu/.local/share/sounds + cp -TRv "${HOME}"/.local/share/grilo-plugins ../ubuntu/.local/share/grilo-plugins + cp -TRv "${HOME}"/.local/share/gnome-shell ../ubuntu/.local/share/gnome-shell + + elif [ "$NAME" == "Zorin OS" ]; then + cp -TRv "${HOME}"/.config/dconf ../zorin/.config/dconf + cp -TRv "${HOME}"/.config/mimeapps.list ../zorin/.config/mimeapps.list + + cp -TRv "${HOME}"/.local/share/sounds ../zorin/.local/share/sounds + cp -TRv "${HOME}"/.local/share/gnome-shell ../zorin/.local/share/gnome-shell + fi + elif command -v lsb_release &> /dev/null; then + echo "Running on $(lsb_release -s -d)" + else + echo "Linux distribution detection requires /etc/os-release or lsb_release" fi -fi + ;; + *) + echo "Running on $OS" + ;; +esac diff --git a/.github/workflows/test_macos.yml b/.github/workflows/test_macos.yml index 30264e3..9f12964 100644 --- a/.github/workflows/test_macos.yml +++ b/.github/workflows/test_macos.yml @@ -41,5 +41,4 @@ jobs: set -e export CI=1 git submodule update --init - cd macos bash install.sh diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test_ubuntu.yml index 31ff033..ff9657d 100644 --- a/.github/workflows/test_ubuntu.yml +++ b/.github/workflows/test_ubuntu.yml @@ -41,6 +41,5 @@ jobs: set -e export CI=1 git submodule update --init - cd linux - bash workflows/test_ubuntu.sh + bash linux/workflows/test_ubuntu.sh bash install.sh diff --git a/Documents.md b/Documents.md index 5561c42..03c5658 100644 --- a/Documents.md +++ b/Documents.md @@ -4,7 +4,7 @@ ======= change npm version ======= ```bash -nvm install v22 +nvm install v22 -g nvm use v22 ``` diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..170c5ae --- /dev/null +++ b/install.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +OS=$(uname -s) + +case "$OS" in + "Darwin") + echo "Running on MacOS" + cd macos || exit + bash install.sh "$1" + ;; + "Linux") + # shellcheck disable=SC1091 + if [ -f "/etc/os-release" ]; then + . /etc/os-release + echo "Running on $NAME" + cd linux || exit + bash install.sh "$1" + elif command -v lsb_release &> /dev/null; then + echo "Running on $(lsb_release -s -d)" + else + echo "Linux distribution detection requires /etc/os-release or lsb_release" + fi + ;; + *) + echo "Running on $OS" + ;; +esac diff --git a/macos/install.sh b/macos/install.sh index 91147d7..f6b5bb7 100644 --- a/macos/install.sh +++ b/macos/install.sh @@ -32,7 +32,7 @@ done echo '####################################################################' brewInstallation() { - APP_LIST=("openkey" "rectangle" "maccy" "keepingyouawake" "iterm2" "skype" "spotify" "anydesk" "teamviewer" "obs" "chatgpt" "slack" "gpg-suite" "notion" "zoom" "figma" "vlc") + APP_LIST=("openkey" "rectangle" "maccy" "keepingyouawake" "iterm2" "karabiner-elements" "skype" "spotify" "anydesk" "teamviewer" "obs" "chatgpt" "slack" "gpg-suite" "notion" "zoom" "figma" "vlc") for appName in "${APP_LIST[@]}"; do echo "=========================== $appName ===========================" @@ -66,7 +66,6 @@ brewInstallation() { echo "" done } -brewInstallation brewFormulaInstallation() { APP_LIST=("flameshot") @@ -100,10 +99,40 @@ brewFormulaInstallation() { echo "" done } -brewFormulaInstallation + +while true; do + if [[ $ACCEPT_INSTALL =~ ^[Yy]$ ]]; then + yn="y" + else + read -r -p "Do you want to install packages, app with brew? (Y/N) " yn + fi + case $yn in + [Yy]*) + brewInstallation + brewFormulaInstallation + break + ;; + [Nn]*) break ;; + *) echo "Please answer yes or no." ;; + esac +done if [[ $ACCEPT_INSTALL =~ ^[Yy]$ ]]; then sudo spctl --master-enable fi -bash config.sh +while true; do + if [[ $ACCEPT_INSTALL =~ ^[Yy]$ ]]; then + yn="y" + else + read -r -p "Do you want to install zsh (Need if it not installed)? (Y/N) " yn + fi + case $yn in + [Yy]*) + bash config.sh + break + ;; + [Nn]*) break ;; + *) echo "Please answer yes or no." ;; + esac +done diff --git a/readme.md b/readme.md index 1473d4e..d2a94b4 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,6 @@ You will need to have an Ubuntu, Zorin OS, or macOS installed on your system. # Installing -## Install for Linux Before running this script, please clone the repository to your local machine. ```bash @@ -39,7 +38,6 @@ cd dotfiles Then, run the following command to install dotfiles. ```bash -cd linux bash install.sh ``` @@ -47,7 +45,7 @@ Now, wait for a while, and you will see some messages questioning do you want to install some tools, please answer **yes(y)**. > [!IMPORTANT] -> ## What to do after overwriting existing configurations? +> ## What to do after overwriting existing configurations? (Only for Linux) > In the installing process, you see a message that says "**Do you want copy and overwrite existing config folders from this source to your os?**". > @@ -62,21 +60,7 @@ this source to your os?**". > > 2. **LOG OUT** and **LOG IN AGAIN** to your OS. -## Install for macOS - -Before running this script on a macOS system, please clone the repository to your local machine. - -```bash -git clone https://github.com/tanhongit/dotfiles.git -cd dotfiles -``` - -Then, navigate to the macOS directory and run the installation script. - -```bash -cd macos -bash install.sh -``` +## Install with option for macOS If you wish to install using the bundle parameter, please add it to the bash command as follows: