rename downloaded script to "sh.zio.backup"
parent
c0ab7cb7b0
commit
652c645d8d
|
@ -3,6 +3,8 @@
|
||||||
wd="$(realpath "$(dirname "$(realpath -s "$0")")/.tmp")"
|
wd="$(realpath "$(dirname "$(realpath -s "$0")")/.tmp")"
|
||||||
git_url_prefix="https://git.zio.sh/zio/rootfs/raw/branch/main"
|
git_url_prefix="https://git.zio.sh/zio/rootfs/raw/branch/main"
|
||||||
helpers_dir="$wd/helpers"
|
helpers_dir="$wd/helpers"
|
||||||
|
backup_script_path="$wd/sh.zio.backup"
|
||||||
|
bash_helper_path="$helpers_dir/bash.sh"
|
||||||
|
|
||||||
function die() {
|
function die() {
|
||||||
echo -e "\033[1;31mError: $@\033[0m"
|
echo -e "\033[1;31mError: $@\033[0m"
|
||||||
|
@ -21,17 +23,17 @@ function fetch() {
|
||||||
mkdir -p "$wd"
|
mkdir -p "$wd"
|
||||||
mkdir -p "$helpers_dir"
|
mkdir -p "$helpers_dir"
|
||||||
|
|
||||||
fetch "$git_url_prefix/usr/local/bin/sh.zio.backup" "$wd/backup.sh"
|
fetch "$git_url_prefix/usr/local/bin/sh.zio.backup" "$backup_script_path"
|
||||||
fetch "$git_url_prefix/usr/local/libexec/zio/helpers/bash.sh" "$wd/helpers/bash.sh"
|
fetch "$git_url_prefix/usr/local/libexec/zio/helpers/bash.sh" "$bash_helper_path"
|
||||||
|
|
||||||
chmod +x "$wd/backup.sh"
|
chmod +x "$backup_script_path"
|
||||||
chmod +x "$helpers_dir/bash.sh"
|
chmod +x "$bash_helper_path"
|
||||||
|
|
||||||
if [[ -n "$SUDO_USER" ]]; then
|
if [[ -n "$SUDO_USER" ]]; then
|
||||||
chown -R "$SUDO_USER" "$wd"
|
chown -R "$SUDO_USER" "$wd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ZIO_HELPERS_DIR="$helpers_dir"
|
export ZIO_HELPERS_DIR="$helpers_dir"
|
||||||
/usr/bin/env bash "$wd/backup.sh" $@
|
/usr/bin/env bash "$backup_script_path" $@
|
||||||
|
|
||||||
rm -rf "$wd"
|
rm -rf "$wd"
|
||||||
|
|
Loading…
Reference in New Issue