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"
|
PROTOCOL="http"
|
||||||
REPO="babbarc/workspaces"
|
REPO="babbarc/workspaces"
|
||||||
BRANCH="master"
|
BRANCH="master"
|
||||||
URL="$PROTOCOL://$HOST/$REPO/raw/branch/$BRANCH"
|
|
||||||
|
|
||||||
LOG_FILE="/tmp/.gitops-router-${PERSON}.log"
|
LOG_FILE="/tmp/.gitops-router-${PERSON}.log"
|
||||||
|
|
||||||
@ -24,15 +23,22 @@ if [[ -z "${SSH_ORIGINAL_COMMAND:-}" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
geurl() {
|
||||||
|
echo "$PROTOCOL://$HOST/$REPO/$1/branch/$BRANCH/$2"
|
||||||
|
}
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
"$HOME"/.local/bin/"$1"
|
"$HOME"/.local/bin/"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
type=${4:-raw}
|
||||||
fname=$(basename "$1")
|
fname=$(basename "$1")
|
||||||
output_path="$HOME/$2/$fname"
|
output_path="$HOME/$2/$fname"
|
||||||
|
url=$(geturl "$type" "$1")
|
||||||
|
|
||||||
[ -f "$output_path" ] && chmod 700 "$output_path"
|
[ -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"
|
chmod "$3" "$output_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +80,9 @@ update)
|
|||||||
clean_dangling_images)
|
clean_dangling_images)
|
||||||
update .bin/clean_dangling_images.sh .local/bin 500
|
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"
|
log error "Invalid arguments for update command: $args"
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user