From d3b67e667fc65d1ea9cf5014c1f48720eef425c8 Mon Sep 17 00:00:00 2001 From: ulises-jeremias Date: Sun, 19 Mar 2023 16:30:05 -0300 Subject: [PATCH] Fixed instalation process --- README.md | 2 +- dots | 2 -- scripts/install | 7 +------ scripts/install-dotfiles | 25 +++++++++++++++---------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0cffb816..4e9367c6 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ cd ./playground/vagrant// │ └── install-pkgs.sh # Debian specific script to install packages from the official repos and other sources ├── default-config # default config files (used by dots when installing in any OS). Check the docs https://github.com/ulises-jeremias/dotfiles/wiki/Customization for more info. │ ├── common/ # common config files to be installed in any OS -│ ├── wm/ # window manager config files to be installed in any OS based on the intallation flag `--wms` +│ ├── wm/ # window manager config files to be installed in any OS based on user input ├── playground # testing environments │ └── docker/ # docker setup to bootstrap the testing environments │ └── vagrant/ # vagrant setup to bootstrap the testing environments diff --git a/dots b/dots index 6d62875c..1156eb18 100755 --- a/dots +++ b/dots @@ -12,7 +12,6 @@ ## -c, --clear Will remove existing dotfiles. ## -u, --upgrade Will update dependencies anyway. ## --dry-run Will not install anything. Just will create the dotfiles dir. -## --interactive Will ask for user input before installing dotfiles. ## --nodeps Will not install dependencies. ## --nodunst Notifications will use xfce4-notifyd instead. ## --utils Will answer you to install some utilities. @@ -20,7 +19,6 @@ ## ## --os=OS_NAME Operating System. Posible values: arch-linux | debian. ## By default, the installation script will determine which is your OS. -## --wms=COMMA_SEPARATED_WMS Window managers. Posible wms: i3, openbox ## --log-file=LOG_FILE_PATH Logs file path, is /tmp/dots_install_log_$(date +'%m-%d-%y_%H:%M:%S').txt by default. ## --dotfiles-dir=OUTPUT_PATH Dotfiles output dir, is ~/dotfiles by default. ## diff --git a/scripts/install b/scripts/install index 1837a7e0..ce1a60e9 100755 --- a/scripts/install +++ b/scripts/install @@ -10,13 +10,11 @@ ## -c, --clear Will remove existing dotfiles. ## -u, --upgrade Will update dependencies anyway. ## --dry-run Will not install anything. Just will create the dotfiles dir. -## --interactive Will ask for user input before installing dotfiles. ## --nodeps Will not install dependencies. ## ## --os=OS_NAME Operating System. Posible values: common | arch-linux | debian ## where common is supposed to work correctly with any linux distro. ## `common` is set as default value for this flag. -## --wms=COMMA_SEPARATED_WMS Window managers. Posible wms: i3, openbox ## --log-file=LOG_FILE_PATH Logs file path, is /tmp/dots_install_log_$(date +'%m-%d-%y_%H:%M:%S').txt by default. ## --dotfiles-dir=OUTPUT_PATH Dotfiles output dir, is ~/dotfiles by default. ## --pkgs=COMMA_SEPARATED_DEPS Dependencies to install. @@ -40,7 +38,6 @@ os=${os:-"common"} time_str=$(date +'%m-%d-%y_%H:%M:%S') log_file=${log_file:-"/tmp/dots_install_log_$time_str.txt"} dotfiles_dir=${dotfiles_dir:-"$HOME/dotfiles"} -wms=${wms:-""} [ ! -f "${log_file}" ] && touch "${log_file}" @@ -80,10 +77,8 @@ echo "${SCRIPTS_DIR}"/install-dotfiles --log-file="${log_file}" \ --dotfiles-dir="${dotfiles_dir}" \ --os="${os}" \ - --wms="${wms}" \ ${dry_run_flag} \ - ${clear_flag} \ - ${interactive_flag} + ${clear_flag} #========================================== # Give the user a summary of what has diff --git a/scripts/install-dotfiles b/scripts/install-dotfiles index 464a400d..f39fd2e2 100755 --- a/scripts/install-dotfiles +++ b/scripts/install-dotfiles @@ -9,12 +9,10 @@ ## -h, --help Help. ## -c, --clear Will remove existing dotfiles before installing the new ones. ## --dry-run Will not install anything. Just will create the dotfiles dir. -## --interactive Will ask for user input before installing dotfiles. ## ## --os=OS_NAME Operating System. Posible values: common | arch-linux | debian | ... ## where common is supposed to work correctly with any linux distro. ## `common` is set as default value for this flag. -## --wms=COMMA_SEPARATED_WMS Window managers. Posible wms: i3, openbox ## --log-file=LOG_FILE_PATH Logs file path, is /tmp/dots_install_log_$(date +'%m-%d-%y_%H:%M:%S').txt by default. ## --dotfiles-dir=OUTPUT_PATH Dotfiles output dir, is ~/dotfiles by default. ## @@ -36,7 +34,6 @@ os=${os:-""} time_str=$(date +'%m-%d-%y_%H:%M:%S') log_file=${log_file:-"/tmp/dots_install_log_$time_str.txt"} dotfiles_dir=${dotfiles_dir:-"${HOME}/dotfiles"} -wms=${wms:-""} [ ! -f "${log_file}" ] && touch "${log_file}" @@ -77,12 +74,10 @@ echo for config_path in "${ROOT}"/common/config/*; do config=$(basename "${config_path}") - if [ -n "${interactive}" ]; then - read -p "Install ${config} dotfiles? [y/N] " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - continue - fi + read -p "Install ${config} dotfiles? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + continue fi describe "Installing ${config} dotfiles" @@ -133,8 +128,18 @@ if [ ! -e "${dotfiles_dir}"/custom-config/README.md ]; then cp -rf "${dotfiles_dir}"/default-config/README.md "${dotfiles_dir}"/custom-config fi -for wm in xfce4 $(echo "${wms}" | tr ',' '\n'); do +available_wms=$(ls "${ROOT}"/default-config/wm) + +for wm in ${available_wms}; do [ -e "${ROOT}/default-config/wm/${wm}/install" ] || continue + # Install default config for xfce4 anyways + if [ "${wm}" != "xfce4" ]; then + read -p "Install ${wm} default config? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + continue + fi + fi cp -rf "${ROOT}"/default-config/wm/"${wm}" "${dotfiles_dir}"/default-config cp -rf "${ROOT}"/default-config/wm/"${wm}" "${dotfiles_dir}"/custom-config chmod +x "${dotfiles_dir}"/default-config/"${wm}"/install