Fix erroneous tag in branch reset
This commit is contained in:
@@ -56,7 +56,7 @@ Profile keys:
|
|||||||
| `files` | No | Host directory containing custom overlay files. In `imagebuilder` mode this is passed as `FILES=<dir>`. In `source` mode contents are synced into `<build dir>/files/` before build. Defaults to `<buildroot>/src/files`. |
|
| `files` | No | Host directory containing custom overlay files. In `imagebuilder` mode this is passed as `FILES=<dir>`. In `source` mode contents are synced into `<build dir>/files/` before build. Defaults to `<buildroot>/src/files`. |
|
||||||
| `cherrypicks` | No | Space-separated source-mode cherry-picks in `URL@branch:commit` form. The target is inferred from the repo basename: `openwrt` applies to the main source tree, any other basename applies to `feeds/<basename>` after feeds update/install. |
|
| `cherrypicks` | No | Space-separated source-mode cherry-picks in `URL@branch:commit` form. The target is inferred from the repo basename: `openwrt` applies to the main source tree, any other basename applies to `feeds/<basename>` after feeds update/install. |
|
||||||
| `branches` | No | Space-separated `URL@branch` entries to merge into the source worktree in `source` mode. |
|
| `branches` | No | Space-separated `URL@branch` entries to merge into the source worktree in `source` mode. |
|
||||||
| `release` | No | Default release/ref for the profile (for example `snapshot`, `25.12.4`). CLI `--release` overrides it. |
|
| `release` | No | Default release/ref for the profile (for example `snapshot`, `25.12.5`). CLI `--release` overrides it. |
|
||||||
| `clean` | No | Optional source cleanup step (`clean`, `targetclean`, `dirclean`, `distclean`). CLI `--clean` overrides it. |
|
| `clean` | No | Optional source cleanup step (`clean`, `targetclean`, `dirclean`, `distclean`). CLI `--clean` overrides it. |
|
||||||
| `repo` | No | Extra Image Builder repository line appended to `repositories.conf` before build. |
|
| `repo` | No | Extra Image Builder repository line appended to `repositories.conf` before build. |
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ Notes:
|
|||||||
|
|
||||||
* `openwrtbuilder -p r4s -p ax6000`
|
* `openwrtbuilder -p r4s -p ax6000`
|
||||||
* `openwrtbuilder -p r4s -r snapshot --debug`
|
* `openwrtbuilder -p r4s -r snapshot --debug`
|
||||||
* `openwrtbuilder -p ax6000 -r 25.12.4 --mode source --debug`
|
* `openwrtbuilder -p ax6000 -r 25.12.5 --mode source --debug`
|
||||||
* `openwrtbuilder -p rpi4 -r 25.12.4 --flash /dev/sdX`
|
* `openwrtbuilder -p rpi4 -r 25.12.5 --flash /dev/sdX`
|
||||||
* `openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1`
|
* `openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1`
|
||||||
|
|
||||||
## Additional Info
|
## Additional Info
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
# Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder.
|
# Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder.
|
||||||
# Copyright 2022-26 Bryan C. Roessler
|
# Copyright 2022-26 Bryan C. Roessler
|
||||||
# Apache 2.0 License
|
# Apache 2.0 License
|
||||||
# See README and ./profiles for device configuration
|
# See README and profiles for device configuration
|
||||||
|
|
||||||
# Set default release
|
# Set default release
|
||||||
: "${DEFAULT_RELEASE:=${RELEASE:="25.12.5"}}" # do find all replace
|
: "${DEFAULT_RELEASE:=${RELEASE:="25.12.5"}}" # do find all replace
|
||||||
|
|
||||||
|
# @description Print usage information
|
||||||
# @internal
|
# @internal
|
||||||
usage() {
|
usage() {
|
||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
@@ -19,7 +20,7 @@ usage() {
|
|||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
--profile,-p PROFILE
|
--profile,-p PROFILE
|
||||||
--release,-r,--version,-v RELEASE ("snapshot", "25.12.4")
|
--release,-r,--version,-v RELEASE ("snapshot", "25.12.5")
|
||||||
Default: From profile or hardcoded RELEASE
|
Default: From profile or hardcoded RELEASE
|
||||||
--buildroot,-b PATH
|
--buildroot,-b PATH
|
||||||
Default: location of openwrtbuilder script
|
Default: location of openwrtbuilder script
|
||||||
@@ -49,11 +50,12 @@ usage() {
|
|||||||
EXAMPLES
|
EXAMPLES
|
||||||
openwrtbuilder -p r4s -r snapshot
|
openwrtbuilder -p r4s -r snapshot
|
||||||
openwrtbuilder -p ax6000 -r 23.05.0-rc3 --mode source --debug
|
openwrtbuilder -p ax6000 -r 23.05.0-rc3 --mode source --debug
|
||||||
openwrtbuilder -p rpi4 -r 25.12.4 --flash /dev/sdX
|
openwrtbuilder -p rpi4 -r 25.12.5 --flash /dev/sdX
|
||||||
openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1
|
openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @description Detect host platform and initialize global variables
|
||||||
# @internal
|
# @internal
|
||||||
init() {
|
init() {
|
||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
@@ -86,10 +88,10 @@ init() {
|
|||||||
RPM_MGR="yum"
|
RPM_MGR="yum"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
rhel) ID="centos" ;;
|
rhel|almalinux|rocky) ID="centos" ;;
|
||||||
linuxmint|neon|*ubuntu*) ID="ubuntu" ;;
|
linuxmint|neon|*ubuntu*) ID="ubuntu" ;;
|
||||||
*suse*) ID="suse" ;;
|
*suse*) ID="suse" ;;
|
||||||
raspbian) ID="debian" ;;
|
raspbian|raspios) ID="debian" ;;
|
||||||
*)
|
*)
|
||||||
echo "Autodetecting distro, this may be unreliable"
|
echo "Autodetecting distro, this may be unreliable"
|
||||||
for cmd in dnf yum apt pacman; do
|
for cmd in dnf yum apt pacman; do
|
||||||
@@ -469,6 +471,7 @@ make_images() {
|
|||||||
return "${PIPESTATUS[0]}" # bash-specific way to return exit code of piped command
|
return "${PIPESTATUS[0]}" # bash-specific way to return exit code of piped command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @description Flashes OpenWRT image to a hardware device (SD card, USB drive, etc.)
|
||||||
flash_images() {
|
flash_images() {
|
||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
local img_gz="$1"
|
local img_gz="$1"
|
||||||
@@ -497,6 +500,7 @@ flash_images() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @description Upgrades OpenWRT via SSH using sysupgrade
|
||||||
ssh_upgrade() {
|
ssh_upgrade() {
|
||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
local img_gz="$1"
|
local img_gz="$1"
|
||||||
@@ -528,6 +532,7 @@ from_source() {
|
|||||||
local cherrypick url_branch branch url remote feed_dir repo_name
|
local cherrypick url_branch branch url remote feed_dir repo_name
|
||||||
local -a make_opts
|
local -a make_opts
|
||||||
|
|
||||||
|
# @description Preprocess a cherrypick spec into its components
|
||||||
preprocess_cherrypick() {
|
preprocess_cherrypick() {
|
||||||
local spec="$1"
|
local spec="$1"
|
||||||
|
|
||||||
@@ -547,6 +552,7 @@ from_source() {
|
|||||||
[[ -z $remote ]] && remote="cherry"
|
[[ -z $remote ]] && remote="cherry"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @description Applies a cherrypick to a git repo worktree
|
||||||
apply_cherrypick() {
|
apply_cherrypick() {
|
||||||
local repo_dir="$1"
|
local repo_dir="$1"
|
||||||
|
|
||||||
@@ -636,9 +642,12 @@ from_source() {
|
|||||||
# Reuse worktree if present; otherwise create it (support branches and tags)
|
# Reuse worktree if present; otherwise create it (support branches and tags)
|
||||||
if git -C "$BUILD_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
if git -C "$BUILD_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
execute git -C "$BUILD_DIR" fetch origin --tags --prune
|
execute git -C "$BUILD_DIR" fetch origin --tags --prune
|
||||||
execute git -C "$BUILD_DIR" reset --hard "origin/$REF" || \
|
if git -C "$SRC_DIR" show-ref --verify --quiet "refs/remotes/origin/$REF"; then
|
||||||
|
execute git -C "$BUILD_DIR" reset --hard "origin/$REF"
|
||||||
|
else
|
||||||
execute git -C "$BUILD_DIR" reset --hard "$REF" || \
|
execute git -C "$BUILD_DIR" reset --hard "$REF" || \
|
||||||
execute git -C "$BUILD_DIR" checkout --detach "$REF"
|
execute git -C "$BUILD_DIR" checkout --detach "$REF"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
execute git -C "$SRC_DIR" worktree prune --verbose
|
execute git -C "$SRC_DIR" worktree prune --verbose
|
||||||
# Prefer local tag/branch if present, otherwise use remote-tracking branch
|
# Prefer local tag/branch if present, otherwise use remote-tracking branch
|
||||||
@@ -692,6 +701,7 @@ from_source() {
|
|||||||
echo "Current commit hash: $commit"
|
echo "Current commit hash: $commit"
|
||||||
echo "Git worktree description: $description"
|
echo "Git worktree description: $description"
|
||||||
|
|
||||||
|
# Print last commit log
|
||||||
((DEBUG)) && git --no-pager -C "$BUILD_DIR" log -1
|
((DEBUG)) && git --no-pager -C "$BUILD_DIR" log -1
|
||||||
|
|
||||||
# Enter worktree
|
# Enter worktree
|
||||||
@@ -794,7 +804,7 @@ from_source() {
|
|||||||
|
|
||||||
# @section Helper functions
|
# @section Helper functions
|
||||||
# @internal
|
# @internal
|
||||||
debug() { ((DEBUG)) && echo "Debug: $*"; }
|
debug() { ((DEBUG)) && echo "[DEBUG] $*"; }
|
||||||
ask_ok() {
|
ask_ok() {
|
||||||
((YES)) && return
|
((YES)) && return
|
||||||
local r
|
local r
|
||||||
@@ -850,6 +860,7 @@ main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create output directories if they don't exist
|
||||||
for dir in "$BUILD_ROOT/src" "$BUILD_ROOT/bin"; do
|
for dir in "$BUILD_ROOT/src" "$BUILD_ROOT/bin"; do
|
||||||
[[ -d "$dir" ]] || execute mkdir -p "$dir"
|
[[ -d "$dir" ]] || execute mkdir -p "$dir"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user