feat: add gitops function to copy home.tar.gz
This commit is contained in:
parent
1fc4153048
commit
14a96035b6
@ -6,7 +6,6 @@ HOST="alps:3222"
|
||||
PROTOCOL="http"
|
||||
REPO="babbarc/workspaces"
|
||||
BRANCH="master"
|
||||
URL="$PROTOCOL://$HOST/$REPO/raw/branch/$BRANCH"
|
||||
|
||||
LOG_FILE="/tmp/.gitops-router-${PERSON}.log"
|
||||
|
||||
@ -24,15 +23,22 @@ if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
geurl() {
|
||||
echo "$PROTOCOL://$HOST/$REPO/$1/branch/$BRANCH/$2"
|
||||
}
|
||||
|
||||
function run() {
|
||||
"$HOME"/.local/bin/"$1"
|
||||
}
|
||||
|
||||
function update() {
|
||||
type=${4:-raw}
|
||||
fname=$(basename "$1")
|
||||
output_path="$HOME/$2/$fname"
|
||||
url=$(geturl "$type" "$1")
|
||||
|
||||
[ -f "$output_path" ] && chmod 700 "$output_path"
|
||||
curl -fsSL "$URL/$1" -o "$output_path" && log info "Downloaded $URL/$1 to $output_path"
|
||||
curl -fsSL "$url" -o "$output_path" && log info "Downloaded $url to $output_path"
|
||||
chmod "$3" "$output_path"
|
||||
}
|
||||
|
||||
@ -74,6 +80,9 @@ update)
|
||||
clean_dangling_images)
|
||||
update .bin/clean_dangling_images.sh .local/bin 500
|
||||
;;
|
||||
home_tar)
|
||||
update home.tar.gz . 500 media
|
||||
;;
|
||||
*)
|
||||
log error "Invalid arguments for update command: $args"
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user