Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions leads_vec/_bootloader/leads_vec.service.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash

if [ ! -x "/usr/local/leads/config.json" ];
if [ ! -r "/usr/local/leads/config.json" ]
then
echo "Error: Config file does not exist"
exit 1
fi
while ! xhost >& /dev/null;
while ! xhost >& /dev/null
do sleep 1
done
# change the interpreter or adjust the arguments according to your needs
Expand Down
4 changes: 2 additions & 2 deletions leads_vec/_bootloader/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def create_service() -> None:
_mkdir("/usr/local/leads")
with open("/usr/local/leads/config.json", "w") as f:
f.write(str(_Config({})))
_chmod("/usr/local/leads/config.json", 777)
_chmod(script := f"{_abspath(__file__)[:-10]}leads_vec.service.sh", 777)
_chmod("/usr/local/leads/config.json", 0x644)
_chmod(script := f"{_abspath(__file__)[:-10]}leads_vec.service.sh", 0o755)
with open("/etc/systemd/system/leads_vec.service", "w") as f:
f.write(
"[Unit]\n"
Expand Down
10 changes: 5 additions & 5 deletions scripts/frp-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi
if ! test -d "/usr/local/frp";
if ! test -d "/usr/local/frp"
then abort "Error: /usr/local/frp not found"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand All @@ -23,14 +23,14 @@ execute_root() {
}

require_argument() {
if [ -n "$1" ];
if [ -n "$1" ]
then echo "$1"
else abort "Required argument $2 does not exist"
fi
}

argument_exists_or() {
if [ -n "$1" ];
if [ -n "$1" ]
then echo "$1"
else echo "$2"
fi
Expand Down
10 changes: 5 additions & 5 deletions scripts/frp-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi

if test -d "/usr/local/frp";
if test -d "/usr/local/frp"
then abort "Error: /usr/local/frp already exists"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand All @@ -23,13 +23,13 @@ execute_root() {
execute "sudo" "$@"
}

if ! command -v curl > /dev/null;
if ! command -v curl > /dev/null
then
echo "cURL is not available, installing..."
execute_root "apt" "install" "-y" "curl"
fi
latest_release=$(curl -s "https://api.github.com/repos/fatedier/frp/releases/latest" | grep -o '"tag_name": "[^"]*' | grep -o '[^"]*$' | cut -c 2-)
if [ -z "$latest_release" ];
if [ -z "$latest_release" ]
then abort "Failed to retrieve the latest release"
fi
filename="frp_${latest_release}_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m)"
Expand Down
4 changes: 2 additions & 2 deletions scripts/obs-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/obs-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/python-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ abort() {
exit 1
}

if [ "${EUID:-$(id -u)}" -ne 0 ];
if [ "${EUID:-$(id -u)}" -ne 0 ]
then abort "Error: This script requires root permission"
fi

execute() {
if ! "$@";
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
Expand Down