diff options
Diffstat (limited to 'sbpull.bash')
| -rw-r--r-- | sbpull.bash | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sbpull.bash b/sbpull.bash new file mode 100644 index 0000000..cd48864 --- /dev/null +++ b/sbpull.bash @@ -0,0 +1,44 @@ +# sbpull: pull one overlay subtree into SBo-danix, then reconcile shadowing. +# Source from root's ~/.bashrc: . /path/to/sbpull.bash +# +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. See the LICENSE file for details. + +sbpull() { + local repo_dir="/var/lib/sbopkg/SBo-danix" + local target="$1" + local prefix branch remote + + case "$target" in + personal) + prefix="personal" + remote="my-slackbuilds" + ;; + pentesting) + prefix="pentesting" + remote="my-pentesting" + ;; + *) + echo "sbpull: usage: sbpull {personal|pentesting}" >&2 + return 1 + ;; + esac + + branch="main" + + pushd "$repo_dir" > /dev/null || return 1 + + if git subtree pull --prefix="$prefix" "$remote" "$branch" --squash; then + echo "sbpull: $target subtree updated." + sbshadow + else + echo "sbpull: git subtree pull failed for $target, check output above." >&2 + popd > /dev/null + return 1 + fi + + popd > /dev/null +} |
