aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-14 10:29:08 +0200
committerDanilo M. <danix@danix.xyz>2026-05-14 10:29:08 +0200
commita35a7805e97b115ae04181dce6cf940e546c7295 (patch)
tree26780a846079a7441467d2dd84686dbbca0ca872
parent804a499754f5fec2db465effb174448d924e344e (diff)
downloadmkhintfile-a35a7805e97b115ae04181dce6cf940e546c7295.tar.gz
mkhintfile-a35a7805e97b115ae04181dce6cf940e546c7295.zip
add --no-dl/-N option to skip downloads and set NODOWNLOAD=yes
Adds --no-dl/-N flag for use with --hintfile or --new. Skips wget, inserts NODOWNLOAD=yes after MD5SUM_x86_64 in the hint file. Also fixes README (correct paths, old command name, missing --delete/--clean sections) and updates CLAUDE.md and bash completion accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--CLAUDE.md7
-rw-r--r--README.md50
-rwxr-xr-xmkhint63
-rw-r--r--mkhint.bash-completion4
4 files changed, 97 insertions, 27 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index ea3e883..61f8e89 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -26,7 +26,10 @@ bash mkhint --help
bash mkhint --list
bash mkhint --version 2.0.1 --hintfile mypackage
bash mkhint --version 1.2.3 --new mypackage
-bash mkhint --new mypackage # empty hint, no version
+bash mkhint --new mypackage # empty hint, no version
+bash mkhint --version 2.0.1 --hintfile mypackage --no-dl # skip downloads, add NODOWNLOAD=yes
+bash mkhint --new mypackage --no-dl # create hint with NODOWNLOAD=yes
+bash mkhint --delete mypackage
bash mkhint --clean
```
@@ -37,6 +40,8 @@ No test suite exists. Test manually against real `REPO_DIR`/`HINT_DIR` or with m
- `--hintfile` update: backs up to `.bak`, replaces old version string globally via `sed`, re-downloads both URLs to recalculate MD5 checksums. Skips download if value is `UNSUPPORTED` or `UNTESTED`.
- `--new` with existing `.info`: copies `.info` as template, strips `PRGNAM`, `HOMEPAGE`, `MAINTAINER`, `EMAIL`, comments out `REQUIRES`, sets `ARCH="x86_64"`.
- `--new` when hint already exists: backs up old, creates empty skeleton.
+- `--no-dl` / `-N`: skips all downloads; inserts `NODOWNLOAD=yes` after `MD5SUM_x86_64=` line. Works with `--hintfile` or `--new`. Error if used alone.
+- `--delete` / `-d`: removes hint file and `.bak` if present. Accepts multiple package names. Exits 2 on first missing file.
- Downloads go to `/tmp/mkhint/download` (single shared temp file, deleted after md5 calculation).
## Exit Codes
diff --git a/README.md b/README.md
index ffb5f85..b0e2a48 100644
--- a/README.md
+++ b/README.md
@@ -21,8 +21,8 @@ sudo cp mkhint.bash-completion /etc/bash-completion.d/mkhint
Edit the paths at the top of mkhint to match your setup (lines 16–17):
```bash
-REPO_DIR="/var/lib/sbopkg/SBo-danix" # Repository containing .info files
-HINT_DIR="/tmp/hintdir" # Directory where .hint files are stored
+REPO_DIR="/var/lib/sbopkg/SBo-danix/" # Repository containing .info files
+HINT_DIR="/etc/slackrepo/SBo-danix/hintfiles/" # Directory where .hint files are stored
```
## Usage
@@ -32,39 +32,70 @@ HINT_DIR="/tmp/hintdir" # Directory where .hint files are stored
Updates the package version, downloads the archive, and recalculates the MD5 checksums:
```bash
-mkhintfile --version 2.0.1 --hintfile mypackage
+mkhint --version 2.0.1 --hintfile mypackage
```
-This replaces the old version with 2.0.1 in mypackage.hint and re-downloads the URLs from DOWNLOAD and DOWNLOAD_x86_64 to update MD5SUM and MD5SUM_x86_64.
+Replaces the old version with 2.0.1 in mypackage.hint and re-downloads the URLs from DOWNLOAD and DOWNLOAD_x86_64 to update MD5SUM and MD5SUM_x86_64.
+
+### Update without downloading
+
+Updates the version string and adds `NODOWNLOAD=yes` to skip checksum verification in slackrepo:
+
+```bash
+mkhint --version 2.0.1 --hintfile mypackage --no-dl
+```
### Create a new hint file from .info
Generates a new hint file from the corresponding repository .info file:
```bash
-mkhintfile --version 1.2.3 --new mypackage
+mkhint --version 1.2.3 --new mypackage
```
The .info file is copied as a template, unwanted variables (PRGNAM, HOMEPAGE, MAINTAINER, EMAIL) are removed, and ARCH is set to x86_64.
+### Create a new hint file with NODOWNLOAD
+
+```bash
+mkhint --new mypackage --no-dl
+```
+
### Create an empty hint file
Creates a fresh hint file with empty variables:
```bash
-mkhintfile --new mypackage
+mkhint --new mypackage
```
### List hint files
```bash
-mkhintfile --list
+mkhint --list
+```
+
+### Delete a hint file
+
+Removes the hint file and its .bak backup if present:
+
+```bash
+mkhint --delete mypackage
+mkhint --delete pkg1 pkg2 pkg3
+```
+
+### Clean backup files
+
+Removes all .bak files from HINT_DIR:
+
+```bash
+mkhint --clean
```
### Help
```bash
-mkhintfile --help
+mkhint --help
```
## Exit Codes
@@ -83,9 +114,10 @@ mkhintfile --help
- MD5SUM - MD5 checksum of the generic archive
- DOWNLOAD_x86_64 - Download URL (x86_64 specific)
- MD5SUM_x86_64 - MD5 checksum of the x86_64 archive
+- NODOWNLOAD - Set to `yes` to skip download/checksum verification in slackrepo
## Notes
- Old versions of hint files are backed up with a .bak extension before being modified.
- If a download URL is set to UNSUPPORTED or UNTESTED, the link is skipped during update.
-- Bash completion for -f/--hintfile and -n/--new autocompletes package names from their respective directories.
+- Bash completion for -f/--hintfile, -n/--new, and -d/--delete autocompletes package names from their respective directories.
diff --git a/mkhint b/mkhint
index b3ccc75..206bcf0 100755
--- a/mkhint
+++ b/mkhint
@@ -9,6 +9,8 @@
# ./mkhint --list List hint files
# ./mkhint --clean Remove .bak files from HINT_DIR
# ./mkhint --delete FILE Delete a hint file (and .bak if present)
+# ./mkhint --no-dl --hintfile FILE Update hint, skip downloads, add NODOWNLOAD=yes
+# ./mkhint --no-dl --new FILE Create hint with NODOWNLOAD=yes
# ./mkhint --help Show this help
set -e
@@ -29,6 +31,7 @@ HINT_FILE=""
NEW_HINT_FILE=""
DELETE_HINT_FILES=()
COMMAND=""
+NO_DL=0
# Show help message
show_help() {
@@ -41,6 +44,8 @@ Usage:
./mkhint --new FILE Create new hint file (no version)
./mkhint --list List hint files
./mkhint --clean Remove .bak files from HINT_DIR
+ ./mkhint --no-dl --hintfile FILE Update hint, skip downloads, add NODOWNLOAD=yes
+ ./mkhint --no-dl --new FILE Create hint with NODOWNLOAD=yes
./mkhint --help Show this help
Options:
@@ -50,6 +55,7 @@ Options:
--list, -l List all hint files in the default directory
--clean, -c Remove all .bak files from HINT_DIR
--delete, -d FILE Delete a hint file (and .bak if present)
+ --no-dl, -N Skip downloads; add NODOWNLOAD=yes to hint file (use with -f or -n)
--help, -h Show this help message
Hint files are stored in: $HINT_DIR
@@ -168,6 +174,10 @@ create_new_hint_file() {
echo 'ARCH="x86_64"' >> $normalized_file
fi
+ if [[ $NO_DL -eq 1 ]]; then
+ add_nodownload "$normalized_file"
+ fi
+
echo "generated $normalized_file from $(basename $info)."
echo "Check variables before using."
fi
@@ -184,12 +194,23 @@ MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
EOF
+ if [[ $NO_DL -eq 1 ]]; then
+ sed -i '/^MD5SUM_x86_64=/a NODOWNLOAD=yes' "$normalized_file"
+ fi
echo "Created new hint file [EMPTY]: $normalized_file"
fi
}
+# Add NODOWNLOAD=yes after MD5SUM_x86_64 line if not already present
+add_nodownload() {
+ local file="$1"
+ if ! grep -q '^NODOWNLOAD=' "$file"; then
+ sed -i '/^MD5SUM_x86_64=/a NODOWNLOAD=yes' "$file"
+ fi
+}
+
# Update existing hint file
update_hint_file() {
cd "$HINT_DIR"
@@ -220,22 +241,23 @@ update_hint_file() {
# Use sed for global replacement of OLD_VERSION in all variables
sed -i "s/${old_version}/${new_version}/g" "$normalized_file"
- download=$(grep '^DOWNLOAD=' "$normalized_file" | sed 's/DOWNLOAD="//;s/"$//')
- if [[ -n "$download" ]]; then
- if [[ $download != "UNSUPPORTED" && $download != "UNTESTED" ]]; then
- # we skip for unsupported or untested arch
- sum=$(download_file ${download})
- sed -i "/^MD5SUM=/s/MD5SUM=\"[^\"]*\"/MD5SUM=\"$sum\"/" "$normalized_file"
+ if [[ $NO_DL -eq 1 ]]; then
+ add_nodownload "$normalized_file"
+ else
+ download=$(grep '^DOWNLOAD=' "$normalized_file" | sed 's/DOWNLOAD="//;s/"$//')
+ if [[ -n "$download" ]]; then
+ if [[ $download != "UNSUPPORTED" && $download != "UNTESTED" ]]; then
+ sum=$(download_file ${download})
+ sed -i "/^MD5SUM=/s/MD5SUM=\"[^\"]*\"/MD5SUM=\"$sum\"/" "$normalized_file"
+ fi
fi
- fi
- # we should repeat the check for x86_64 DOWNLOAD
- download_x64=$(grep '^DOWNLOAD_x86_64=' "$normalized_file" | sed 's/DOWNLOAD_x86_64="//;s/"$//')
- if [[ -n "$download_x64" ]]; then
- if [[ $download_x64 != "UNSUPPORTED" && $download_x64 != "UNTESTED" ]]; then
- # we skip for unsupported or untested arch
- sum64=$(download_file ${download_x64})
- sed -i "/^MD5SUM_x86_64=/s/MD5SUM_x86_64=\"[^\"]*\"/MD5SUM_x86_64=\"$sum64\"/" "$normalized_file"
+ download_x64=$(grep '^DOWNLOAD_x86_64=' "$normalized_file" | sed 's/DOWNLOAD_x86_64="//;s/"$//')
+ if [[ -n "$download_x64" ]]; then
+ if [[ $download_x64 != "UNSUPPORTED" && $download_x64 != "UNTESTED" ]]; then
+ sum64=$(download_file ${download_x64})
+ sed -i "/^MD5SUM_x86_64=/s/MD5SUM_x86_64=\"[^\"]*\"/MD5SUM_x86_64=\"$sum64\"/" "$normalized_file"
+ fi
fi
fi
@@ -322,6 +344,10 @@ main() {
shift
done
;;
+ --no-dl|-N)
+ NO_DL=1
+ shift
+ ;;
--help|-h)
COMMAND="help"
shift
@@ -345,6 +371,11 @@ main() {
fi
fi
+ if [[ $NO_DL -eq 1 && -z "$HINT_FILE" && -z "$NEW_HINT_FILE" ]]; then
+ echo "Error: --no-dl requires --hintfile or --new" >&2
+ exit 1
+ fi
+
case "$COMMAND" in
help)
show_help
@@ -356,7 +387,9 @@ main() {
clean_bak_files
;;
update)
- check_wget
+ if [[ $NO_DL -eq 0 ]]; then
+ check_wget
+ fi
update_hint_file "$HINT_FILE" "$VERSION"
;;
new)
diff --git a/mkhint.bash-completion b/mkhint.bash-completion
index 43a64ae..8c52fb1 100644
--- a/mkhint.bash-completion
+++ b/mkhint.bash-completion
@@ -8,7 +8,7 @@ _mkhintfile_completions() {
repo_dir="/var/lib/sbopkg/SBo-danix"
hint_dir="/etc/slackrepo/SBo-danix/hintfiles"
- local all_flags="--version --hintfile --new --list --clean --delete --help"
+ local all_flags="--version --hintfile --new --list --clean --delete --no-dl --help"
case "$prev" in
--new|-n)
@@ -34,4 +34,4 @@ _mkhintfile_completions() {
esac
}
-complete -F _mkhintfile_completions mkhintfile.sh mkhintfile
+complete -F _mkhintfile_completions mkhint.sh mkhint