Skip to content

Commit c4bebaa

Browse files
committed
chore: changed RELEASE_URL to DOWNLOAD_URL
1 parent 62f2b7f commit c4bebaa

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

APPw

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# --- Configuration (Non-Overridable) ---
44
APP_NAME="APP"
55
APP_DIR=".APP"
6-
RELEASE_URL="https://example.com/releases/.../foo-latest.tgz"
6+
DOWNLOAD_URL="https://example.com/releases/.../foo-latest.tgz"
77
# ---------------------------------------
88

99
# 1. Setup essential variables needed for config loading
@@ -74,10 +74,10 @@ perform_full_install() {
7474
mkdir -p "$CACHE_DIR" || { LOG "Error: Could not create cache directory $CACHE_DIR"; exit 1; }
7575

7676
# 2. Download the release archive
77-
LOG "Downloading $RELEASE_URL..."
77+
LOG "Downloading $DOWNLOAD_URL..."
7878
# The --remote-time (-r) option ensures the local file date matches the remote server's date.
79-
if ! curl -fsSL --remote-time "$RELEASE_URL" -o "$ARCHIVE_FILE"; then
80-
LOG "Error: Download failed for $RELEASE_URL."
79+
if ! curl -fsSL --remote-time "$DOWNLOAD_URL" -o "$ARCHIVE_FILE"; then
80+
LOG "Error: Download failed for $DOWNLOAD_URL."
8181
exit 1
8282
fi
8383

@@ -136,7 +136,7 @@ handle_update_check() {
136136
LOG "Attempting conditional download..."
137137

138138
# Use -w "%{http_code}" to capture the status code
139-
HTTP_CODE=$(curl -w "%{http_code}" -sSL --remote-time -z "$ARCHIVE_FILE" "$RELEASE_URL" -o "$ARCHIVE_FILE")
139+
HTTP_CODE=$(curl -w "%{http_code}" -sSL --remote-time -z "$ARCHIVE_FILE" "$DOWNLOAD_URL" -o "$ARCHIVE_FILE")
140140

141141
# 3. Check for successful download (HTTP 200) or successful conditional skip (HTTP 304 Not Modified)
142142
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then

APPw.cmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ setlocal enableExtensions enableDelayedExpansion
44
rem --- Configuration (Non-Overridable) ---
55
set APP_NAME=APP
66
set APP_DIR=.APP
7-
set RELEASE_URL=https://example.com/releases/.../foo-latest.zip
7+
set DOWNLOAD_URL=https://example.com/releases/.../foo-latest.zip
88
rem ---------------------------------------
99

1010
rem 1. Setup essential variables needed for config loading
@@ -53,12 +53,12 @@ rem --- Core Logic Functions ---
5353
)
5454

5555
rem 2. Download the release archive
56-
call :LOG "Downloading %RELEASE_URL%..."
56+
call :LOG "Downloading %DOWNLOAD_URL%..."
5757
rem The --remote-time (-r) option ensures the local file date matches the remote server's date.
5858
rem curl -o saves the output to the specified file
59-
curl -fsSL --remote-time "%RELEASE_URL%" -o "%ARCHIVE_FILE%"
59+
curl -fsSL --remote-time "%DOWNLOAD_URL%" -o "%ARCHIVE_FILE%"
6060
if errorlevel 1 (
61-
call :LOG "Error: Download failed for %RELEASE_URL%."
61+
call :LOG "Error: Download failed for %DOWNLOAD_URL%."
6262
exit /b 1
6363
)
6464

@@ -71,10 +71,10 @@ rem --- Core Logic Functions ---
7171
rem Create a temporary directory for unpacking
7272
mkdir "%APP_HOME%\temp_install"
7373

74-
rem Use the built-in 'tar' utility for ZIP extraction
74+
rem Use the built-in 'tar' utility for ZIP/TAR.GZ extraction
7575
tar -xf "%ARCHIVE_FILE%" -C "%APP_HOME%\temp_install"
7676
if errorlevel 1 (
77-
call :LOG "Error: Failed to unpack archive %ARCHIVE_FILE%. Check if it's a valid ZIP."
77+
call :LOG "Error: Failed to unpack archive %ARCHIVE_FILE%. Check if it's a valid ZIP or TAR.GZ file."
7878
rmdir /s /q "%APP_HOME%\temp_install"
7979
exit /b 1
8080
)
@@ -133,7 +133,7 @@ rem --- Core Logic Functions ---
133133
call :LOG "Attempting conditional download..."
134134
rem -z "%ARCHIVE_FILE%" tells curl to only download if the remote file is newer than the local one.
135135
rem --remote-time (-r) ensures the new file uses the remote timestamp.
136-
curl -fsSL --remote-time -z "%ARCHIVE_FILE%" "%RELEASE_URL%" -o "%ARCHIVE_FILE%"
136+
curl -fsSL --remote-time -z "%ARCHIVE_FILE%" "%DOWNLOAD_URL%" -o "%ARCHIVE_FILE%"
137137

138138
set "CURL_EXIT_CODE=%ERRORLEVEL%"
139139

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ Configuration is managed in two ways:
2424

2525
These variables are defined directly at the top of the scripts and **should not** be overridden by bootstrap.cfg.
2626

27-
| Variable | Default Value (Example) | Description |
28-
|:----------------|:--------------------------|:---------------------------------------------------------------------------------|
29-
| **APP_NAME** | `APP` | The short name of the application. |
30-
| **APP_DIR** | `.APP` | The installation directory name of the application. |
31-
| **RELEASE_URL** | `https://example.com/...` | The direct download URL for the release archive (.tgz for Bash, .zip for Batch). |
27+
| Variable | Default Value (Example) | Description |
28+
|:-----------------|:--------------------------|:-----------------------------------------------------------------------------------------|
29+
| **APP_NAME** | `APP` | The short name of the application. |
30+
| **APP_DIR** | `.APP` | The installation directory name of the application. |
31+
| **DOWNLOAD_URL** | `https://example.com/...` | The direct download URL for the release archive (.tgz for Bash, .zip or .tgz for Batch). |
3232

3333
### **2\. Overridable Variables**
3434

@@ -66,7 +66,7 @@ UPDATE_PERIOD=7
6666

6767
## **Usage**
6868

69-
1. **Configure:** Edit the `NAME` and `RELEASE_URL` variables (and possibly `APP_DIR` if you want a different name than the default) at the top of both scripts (`APPw` and `APPw.bat`).
69+
1. **Configure:** Edit the `NAME` and `DOWNLOAD_URL` variables (and possibly `APP_DIR` if you want a different name than the default) at the top of both scripts (`APPw` and `APPw.bat`).
7070
2. **Rename:** Rename the scripts to match your application's name. Common usage is to have the name of the scripts end in the letter “w” to indicate they are “wrapper” scripts (e.g., if `APP_NAME=foo`, rename to `foow` and `foow.bat`).
7171
3. **Execute:** Place the scripts in a directory where you want the command to be available and run it:
7272

0 commit comments

Comments
 (0)