diff --git a/Makefile b/Makefile index 41e1878d..487072af 100644 --- a/Makefile +++ b/Makefile @@ -16,32 +16,32 @@ backup: ## Backup your current dotfiles. .PHONY: clean clean: # @HELP -clean: ## Removes any previous setup directories. +clean: ## Removes any previous setup. clean: @$(HOMEDIR)/scripts/clean.sh clean .PHONY: copy -copy: # @HELP Copy the dotfiles on your system. +copy: # @HELP copy: ## Copy the dotfiles on your system. - @$(HOMEDIR)/scripts/dotfiles copy + @$(HOMEDIR)/scripts/copy.sh copy .PHONY: download -download: # @HELP Download the dotfiles on your system. +download: # @HELP download: ## Download the dotfiles on your system. - @$(HOMEDIR)/scripts/dotfiles download + @$(HOMEDIR)/scripts/download.sh download -.PHONY: assemble -assemble: # @HELP Assemble the dotfiles on your system. -assemble: ## Run the full installation process. - @$(HOMEDIR)/scripts/dotfiles assemble +.PHONY: build +build: # @HELP +build: ## Run the full installation process. + @$(HOMEDIR)/scripts/build.sh build .PHONY: unpack -unpack: # @HELP Unpack the dotfiles on your system. +unpack: # @HELP unpack: ## Extract the dotfiles to your system. - @$(HOMEDIR)/scripts/dotfiles unpack + @$(HOMEDIR)/scripts/unpack.sh unpack .PHONY: help -help: # @HELP Display the help menu. +help: # @HELP help: ## Display the help menu. @$(BANNER) @awk 'BEGIN {FS = ":.*##"; printf "\USAGE:\n\n make \033[1;96m[COMMAND]\033[0m\n\nCOMMANDS:\n\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[1;96m%-8s\033[0m -%s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/lib/configurations/default/constants.sh b/lib/configurations/default/constants.sh index 32de5b68..0cefb213 100755 --- a/lib/configurations/default/constants.sh +++ b/lib/configurations/default/constants.sh @@ -4,13 +4,15 @@ # License: MIT ## πŸ…³πŸ…ΎπŸ†ƒπŸ…΅πŸ…ΈπŸ…»πŸ…΄πŸ†‚ πŸ†…πŸ…°πŸ†πŸ…ΈπŸ…°πŸ…±πŸ…»πŸ…΄πŸ†‚ - Set Dotfiles variables. -# DF_CURRENT_DIR=${PWD} # Current directory. +# DF_CURRENT_DIR=${PWD} # Current directory. +DF=".dotfiles/" # Dotfiles. DF_DIR="${HOME}/.dotfiles/" # Dotfiles directory. -DF_BACKUPDIR="${HOME}/dotfiles_backup" # Backup directory. +DF_BACKUPDIR="${HOME}/dotfiles_backup/" # Backup directory. DF_DOWNLOADDIR="${HOME}/Downloads" # Download directory. DF_VERSION="0.2.459" # Dotfiles Version number. DF_TIMESTAMP="$(date +%Y-%m-%d_%H-%M-%S)" # Timestamp for backup directory. +export DF export DF_BACKUPDIR export DF_DIR export DF_DOWNLOADDIR diff --git a/scripts/backup.sh b/scripts/backup.sh index 27fb8495..83fdc7d7 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -30,9 +30,14 @@ backup() { # Backup existing Dotfiles directory. if [[ -d "${HOME}"/.dotfiles ]]; then - echo "${GREEN} βœ”${NC} Backing up previous Dotfiles installation to '${GREEN}${DF_BACKUPDIR}/${DF_TIMESTAMP}/${NC}'..." + echo "${GREEN} βœ”${NC} Backing up previous Dotfiles installation to '${GREEN}${DF_BACKUPDIR}${DF_TIMESTAMP}/${NC}'..." # shellcheck disable=SC2154 - mv -f "${DF_DOTFILESDIR}" "${HOME}"/dotfiles_backup/"${DF_TIMESTAMP}"/ + if [[ -d "${DF_BACKUPDIR}${DF_TIMESTAMP}/${DF}" ]]; then + mv -f "${DF_DOTFILESDIR}" "${DF_BACKUPDIR}${DF_TIMESTAMP}/${DF}" + else + mkdir -p "${DF_BACKUPDIR}${DF_TIMESTAMP}/${DF}" + mv -f "${DF_DOTFILESDIR}" "${DF_BACKUPDIR}${DF_TIMESTAMP}/${DF}" + fi fi # File list (use trailing slash for directories) diff --git a/scripts/assemble.sh b/scripts/build.sh similarity index 72% rename from scripts/assemble.sh rename to scripts/build.sh index e258c491..997302ea 100755 --- a/scripts/assemble.sh +++ b/scripts/build.sh @@ -18,8 +18,8 @@ # shellcheck disable=SC1091 . "./scripts/copy.sh" -## πŸ…°πŸ†‚πŸ†‚πŸ…΄πŸ…ΌπŸ…±πŸ…»πŸ…΄ - Assemble the dotfiles on your system. -assemble() { +## πŸ…±πŸ†„πŸ…ΈπŸ…»πŸ…³ - Build the dotfiles on your system. +build() { # shellcheck disable=SC2154 echo "${RED}❭${NC} Preparing the dotfiles on your system." @@ -30,3 +30,10 @@ assemble() { copy } + +args=$* # Arguments passed to script. +export args="${args}" # Exporting arguments. +if [[ ${args} = "build" ]]; then + echo "$*" + build +fi diff --git a/scripts/copy.sh b/scripts/copy.sh index 2166d234..6a120b66 100755 --- a/scripts/copy.sh +++ b/scripts/copy.sh @@ -62,7 +62,7 @@ copy() { echo "${GREEN} βœ”${NC} Copying '${YELLOW}.gemrc${NC}'" && # inputrc -- Copying .inputrc file. - cp -f "${PWD}"/lib/configurations/inputrc/inputrc "${HOME}"/.inputrc && + cp -f "${PWD}"/lib/configurations/input/inputrc "${HOME}"/.inputrc && echo "${GREEN} βœ”${NC} Copying '${YELLOW}.inputrc${NC}'" && # jshintrc -- Copying .jshintrc file. diff --git a/scripts/download.sh b/scripts/download.sh index f536c7c3..0159d099 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -13,11 +13,21 @@ export DF_DOTFILESDIR # Exporting Location of dotfiles. ## πŸ…³πŸ…ΎπŸ††πŸ…½πŸ…»πŸ…ΎπŸ…°πŸ…³ - Download the dotfiles on your system. download() { # shellcheck disable=SC2154 - echo "${RED}❭${NC} Downloading ${GREEN}Dotfiles v${DF_VERSION}${NC} on your system." + echo "${RED}❭${NC} Downloading ${GREEN}Dotfiles v${DF_VERSION}${NC} on your system at ${GREEN}${DF_DOWNLOADDIR}${NC}..." + # Download the dotfiles with curl. # shellcheck disable=SC2154 - # wget https://github.com/sebastienrousseau/dotfiles/archive/refs/tags/v"${DF_VERSION}".zip -N -O "${DF_DOWNLOADDIR}/v${DF_VERSION}.zip" + # curl -0 https://github.com/sebastienrousseau/dotfiles/archive/refs/tags/v"${DF_VERSION}".tar.gz -o "${DF_DOWNLOADDIR}"/dotfiles-"${DF_VERSION}".tar.gz + # Download the dotfiles with wget. # shellcheck disable=SC2154 - curl https://github.com/sebastienrousseau/dotfiles/archive/refs/tags/v"${DF_VERSION}".zip -o "${DF_DOWNLOADDIR}"/v"${DF_VERSION}".zip + wget --no-check-certificate --content-disposition https://github.com/sebastienrousseau/dotfiles/archive/refs/tags/v"${DF_VERSION}".zip -O "${DF_DOWNLOADDIR}/v${DF_VERSION}.zip" + } + +args=$* # Arguments passed to script. +export args="${args}" # Exporting arguments. +if [[ ${args} = "download" ]]; then + echo "$*" + download +fi diff --git a/scripts/help.sh b/scripts/help.sh index cdb75f99..93fd0c5f 100755 --- a/scripts/help.sh +++ b/scripts/help.sh @@ -29,10 +29,10 @@ USAGE: COMMANDS: $(echo -e "\033[1;96mbackup\033[0m\n") - Backup your current dotfiles. - $(echo -e "\033[1;96mclean\033[0m\n") - Removes any previous setup directories. + $(echo -e "\033[1;96mclean\033[0m\n") - Removes any previous setup. $(echo -e "\033[1;96mcopy\033[0m\n") - Copy the dotfiles on your system. $(echo -e "\033[1;96mdownload\033[0m\n") - Download the dotfiles on your system. - $(echo -e "\033[1;96massemble\033[0m\n") - Run the full installation process. + $(echo -e "\033[1;96mbuild\033[0m\n") - Run the full installation process. $(echo -e "\033[1;96munpack\033[0m\n") - Extract the dotfiles to your system. $(echo -e "\033[1;96mhelp\033[0m\n") - Display the help menu.