|
|
@ -12,6 +12,11 @@ function Help() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function Init() {
|
|
|
|
function Init() {
|
|
|
|
|
|
|
|
# Check if the user is root or sudo
|
|
|
|
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
|
|
|
|
echo "Please run as root"
|
|
|
|
|
|
|
|
exit
|
|
|
|
|
|
|
|
fi
|
|
|
|
VERSION="latest"
|
|
|
|
VERSION="latest"
|
|
|
|
InitOS
|
|
|
|
InitOS
|
|
|
|
InitArch
|
|
|
|
InitArch
|
|
|
@ -112,7 +117,7 @@ function InitDownloadTools() {
|
|
|
|
function Download() {
|
|
|
|
function Download() {
|
|
|
|
case "$download_tool" in
|
|
|
|
case "$download_tool" in
|
|
|
|
curl)
|
|
|
|
curl)
|
|
|
|
curl -L "$1" -o "$2"
|
|
|
|
curl -L "$1" -o "$2" --progress-bar
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "download $1 failed"
|
|
|
|
echo "download $1 failed"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
@ -178,6 +183,10 @@ function InstallWithVersion() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function InitLinuxSystemctlService() {
|
|
|
|
function InitLinuxSystemctlService() {
|
|
|
|
|
|
|
|
if [ -z "$(command -v systemctl)" ]; then
|
|
|
|
|
|
|
|
echo "systemctl command not found"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
mkdir -p "/opt/synctv"
|
|
|
|
mkdir -p "/opt/synctv"
|
|
|
|
if [ ! -d "/etc/systemd/system" ]; then
|
|
|
|
if [ ! -d "/etc/systemd/system" ]; then
|
|
|
|
echo "/etc/systemd/system not found"
|
|
|
|
echo "/etc/systemd/system not found"
|
|
|
@ -214,14 +223,6 @@ function InitSystemctlService() {
|
|
|
|
linux)
|
|
|
|
linux)
|
|
|
|
InitLinuxSystemctlService
|
|
|
|
InitLinuxSystemctlService
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
darwin)
|
|
|
|
|
|
|
|
echo "darwin not support"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
echo "OS not supported"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|