diff --git a/pull.sh b/.scripts/_git-pull.sh similarity index 100% rename from pull.sh rename to .scripts/_git-pull.sh diff --git a/.scripts/app-installer/nekoray.sh b/.scripts/app-installer/nekoray.sh deleted file mode 100755 index d112b75..0000000 --- a/.scripts/app-installer/nekoray.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -source ../utils/init.sh - -DOWNLOAD_URL="https://github.com/MatsuriDayo/nekoray/releases/download/3.26/nekoray-3.26-2023-12-09-linux64.zip" -FILE_NAME="nekoray.zip" - -install_nekoray() { - download_file "$DOWNLOAD_URL" "$FILE_NAME" - extract_file "/tmp/$FILE_NAME" - move_to_opt "/tmp/nekoray" -} - -install_nekoray diff --git a/.scripts/utils/_links.sh b/.scripts/utils/_symlinks.sh similarity index 100% rename from .scripts/utils/_links.sh rename to .scripts/utils/_symlinks.sh diff --git a/.scripts/utils/init.sh b/.scripts/utils/init.sh index d690717..32dddad 100755 --- a/.scripts/utils/init.sh +++ b/.scripts/utils/init.sh @@ -54,91 +54,3 @@ ask_prompt() { esac done } - -download_file() { - check_command wget - params_required "URL" "$1" - - local url="$1" - local tmp_dir="/tmp" - local filename="${2:-$(basename "$url")}" - local file_path="$tmp_dir/$filename" - - if [ -e "$file_path" ]; then - if ask_prompt "File $file_path already exists. Do you want to continue ?"; then - log "Continuing with existing file: $file_path" - wget -q --show-progress -c -O "$tmp_dir/$filename" "$url" - else - log "Deleted existing file: $file_path" - wget -q --show-progress -O "$tmp_dir/$filename" "$url" - fi - else - wget -q --show-progress -O "$tmp_dir/$filename" "$url" - fi - - if [ $? -eq 0 ]; then - log "File downloaded successfully: $tmp_dir/$filename" - else - log "Failed to download file from $url" - fi -} - -extract_file() { - params_required "File" "$1" - check_command unzip - - local file_path="$1" - local tmp_dir="/tmp" - local target_destination=${2:-$tmp_dir} - - if [ ! -e $file_path ]; then - log "File $file_path not found." - exit 1 - fi - - unzip -o $file_path -d $target_destination - - if [ $? -eq 0 ]; then - log "File extracted successfully: $tmp_dir/$file_path" - else - log "Failed to extract file !" - fi - -} - -move_to_opt() { - params_required "Source" "$1" - - local source_path="$1" - - if [ -z "$source_path" ]; then - log "No source path provided." - exit 1 - fi - - if [ ! -e "$source_path" ]; then - log "Source path '$source_path' does not exist." - return 1 - fi - - if [ ! -d "$source_path" ] && [ ! -f "$source_path" ]; then - log "Source path '$source_path' is neither a directory nor a file." - return 1 - fi - - local filename="$(basename "$source_path")" - local destination="/opt/$filename" - - if [ -e "$destination" ]; then - if ask_prompt "File or directory '$destination' already exists in /opt. Do you want to cancel ?"; then - log "Continuing with existing file or directory: $destination" - exit 1 - else - log "Deleting existing file or directory: $destination" - sudo rm -rf "$destination" - fi - else - sudo mv "$source_path" "$destination" - fi - -} diff --git a/stow.sh b/stow.sh index 26a6610..3b3317b 100755 --- a/stow.sh +++ b/stow.sh @@ -1,7 +1,7 @@ #!/bin/bash source .scripts/utils/init.sh -source .scripts/utils/_links.sh +source .scripts/utils/_symlinks.sh DOTS_CONFIG_DIR="$(pwd)/linux-configs" DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles"