mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 12:54:04 +02:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
e5adbd266f
commit
f728166b14
@@ -7,7 +7,7 @@ set +u
|
||||
source /etc/birdnet/birdnet.conf
|
||||
|
||||
# Create ingress configuration for Caddyfile
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
cat <<EOF >>/etc/caddy/Caddyfile
|
||||
:8082 {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
|
||||
@@ -2,106 +2,106 @@
|
||||
|
||||
# Function to show the current timezone using two alternative methods
|
||||
show_timezone() {
|
||||
if [ -f /data/timezone ]; then
|
||||
cat /data/timezone
|
||||
elif [ -f /etc/timezone ]; then
|
||||
cat /etc/timezone
|
||||
elif [ -f /etc/localtime ]; then
|
||||
readlink /etc/localtime | sed 's|/usr/share/zoneinfo/||'
|
||||
else
|
||||
echo "Cannot determine timezone."
|
||||
fi
|
||||
if [ -f /data/timezone ]; then
|
||||
cat /data/timezone
|
||||
elif [ -f /etc/timezone ]; then
|
||||
cat /etc/timezone
|
||||
elif [ -f /etc/localtime ]; then
|
||||
readlink /etc/localtime | sed 's|/usr/share/zoneinfo/||'
|
||||
else
|
||||
echo "Cannot determine timezone."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to set the timezone
|
||||
set_timezone() {
|
||||
local new_timezone="$1"
|
||||
if [ ! -f "/usr/share/zoneinfo/$new_timezone" ]; then
|
||||
echo "Invalid timezone: $new_timezone"
|
||||
return 1
|
||||
fi
|
||||
local new_timezone="$1"
|
||||
if [ ! -f "/usr/share/zoneinfo/$new_timezone" ]; then
|
||||
echo "Invalid timezone: $new_timezone"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$new_timezone" > /data/timezone
|
||||
echo "$new_timezone" > /etc/timezone
|
||||
ln -sf "/usr/share/zoneinfo/$new_timezone" /etc/localtime
|
||||
echo "$new_timezone" >/data/timezone
|
||||
echo "$new_timezone" >/etc/timezone
|
||||
ln -sf "/usr/share/zoneinfo/$new_timezone" /etc/localtime
|
||||
|
||||
# Update /etc/environment if it exists
|
||||
if [ -f /etc/environment ]; then
|
||||
sed -i "/^TZ=/c\TZ=$new_timezone" /etc/environment
|
||||
fi
|
||||
# Update /etc/environment if it exists
|
||||
if [ -f /etc/environment ]; then
|
||||
sed -i "/^TZ=/c\TZ=$new_timezone" /etc/environment
|
||||
fi
|
||||
|
||||
# Update s6 container environment if it exists
|
||||
if [ -d /var/run/s6/container_environment ]; then
|
||||
echo "$new_timezone" > /var/run/s6/container_environment/TZ
|
||||
fi
|
||||
# Update s6 container environment if it exists
|
||||
if [ -d /var/run/s6/container_environment ]; then
|
||||
echo "$new_timezone" >/var/run/s6/container_environment/TZ
|
||||
fi
|
||||
|
||||
echo "Timezone set to: $new_timezone"
|
||||
echo "Timezone set to: $new_timezone"
|
||||
}
|
||||
|
||||
# Function to enable or disable NTP
|
||||
set_ntp() {
|
||||
case "$1" in
|
||||
"false")
|
||||
systemctl stop systemd-timesyncd
|
||||
systemctl disable systemd-timesyncd
|
||||
echo "NTP disabled"
|
||||
;;
|
||||
"true")
|
||||
systemctl start systemd-timesyncd
|
||||
systemctl enable systemd-timesyncd
|
||||
case "$1" in
|
||||
"false")
|
||||
systemctl stop systemd-timesyncd
|
||||
systemctl disable systemd-timesyncd
|
||||
echo "NTP disabled"
|
||||
;;
|
||||
"true")
|
||||
systemctl start systemd-timesyncd
|
||||
systemctl enable systemd-timesyncd
|
||||
|
||||
# Remove the /data/timezone file when NTP is enabled
|
||||
if [ -f /data/timezone ]; then
|
||||
rm -f /data/timezone
|
||||
echo "Timezone configuration file /data/timezone deleted."
|
||||
fi
|
||||
# Remove the /data/timezone file when NTP is enabled
|
||||
if [ -f /data/timezone ]; then
|
||||
rm -f /data/timezone
|
||||
echo "Timezone configuration file /data/timezone deleted."
|
||||
fi
|
||||
|
||||
echo "NTP enabled"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument for set-ntp. Use 'false' or 'true'."
|
||||
;;
|
||||
esac
|
||||
echo "NTP enabled"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument for set-ntp. Use 'false' or 'true'."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to show detailed time settings
|
||||
show_time_details() {
|
||||
local local_time
|
||||
local utc_time
|
||||
local time_zone
|
||||
local ntp_status="no"
|
||||
local ntp_service="inactive"
|
||||
local local_time
|
||||
local utc_time
|
||||
local time_zone
|
||||
local ntp_status="no"
|
||||
local ntp_service="inactive"
|
||||
|
||||
local_time="$(date)"
|
||||
utc_time="$(date -u)"
|
||||
time_zone="$(show_timezone)"
|
||||
|
||||
# Check if NTP is used
|
||||
if systemctl is-active --quiet systemd-timesyncd; then
|
||||
ntp_status="yes"
|
||||
ntp_service="active"
|
||||
fi
|
||||
local_time="$(date)"
|
||||
utc_time="$(date -u)"
|
||||
time_zone="$(show_timezone)"
|
||||
|
||||
# Print the information
|
||||
echo "Local time: $local_time"
|
||||
echo "Universal time: $utc_time"
|
||||
echo "Time zone: $time_zone"
|
||||
echo "Network time on: $ntp_status"
|
||||
echo "NTP service: $ntp_service"
|
||||
# Check if NTP is used
|
||||
if systemctl is-active --quiet systemd-timesyncd; then
|
||||
ntp_status="yes"
|
||||
ntp_service="active"
|
||||
fi
|
||||
|
||||
# Print the information
|
||||
echo "Local time: $local_time"
|
||||
echo "Universal time: $utc_time"
|
||||
echo "Time zone: $time_zone"
|
||||
echo "Network time on: $ntp_status"
|
||||
echo "NTP service: $ntp_service"
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
case "$1" in
|
||||
"set-ntp")
|
||||
set_ntp "$2"
|
||||
;;
|
||||
"show")
|
||||
show_timezone
|
||||
;;
|
||||
"set-timezone")
|
||||
set_timezone "$2"
|
||||
;;
|
||||
*)
|
||||
show_time_details
|
||||
;;
|
||||
"set-ntp")
|
||||
set_ntp "$2"
|
||||
;;
|
||||
"show")
|
||||
show_timezone
|
||||
;;
|
||||
"set-timezone")
|
||||
set_timezone "$2"
|
||||
;;
|
||||
*)
|
||||
show_time_details
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") COMMAND [ARGS...]
|
||||
|
||||
Commands:
|
||||
@@ -36,8 +36,8 @@ EOF
|
||||
|
||||
# Safely exit on errors
|
||||
abort() {
|
||||
echo "Error: $*" >&2
|
||||
exit 1
|
||||
echo "Error: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -45,180 +45,180 @@ abort() {
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
show_status() {
|
||||
echo "=== System Time/Date ==="
|
||||
date
|
||||
echo "=== System Time/Date ==="
|
||||
date
|
||||
|
||||
echo
|
||||
echo "=== Time Zone ==="
|
||||
# Attempt to parse the symlink at /etc/localtime
|
||||
# On many systems, /etc/localtime is a symlink to /usr/share/zoneinfo/Region/City
|
||||
if [ -L /etc/localtime ]; then
|
||||
local tz_target
|
||||
tz_target=$(readlink -f /etc/localtime)
|
||||
# Remove the /usr/share/zoneinfo/ part to display just Region/City
|
||||
local tz_name
|
||||
tz_name="${tz_target#/usr/share/zoneinfo/}"
|
||||
echo "Time zone: $tz_name"
|
||||
else
|
||||
# Some distros have /etc/localtime as a copy of the zone file
|
||||
# Try to read /etc/timezone as a fallback (Debian-based)
|
||||
if [ -f /etc/timezone ]; then
|
||||
echo "Time zone: $(cat /etc/timezone)"
|
||||
else
|
||||
echo "Time zone: Unknown (not a symlink, and /etc/timezone missing)"
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
echo "=== Time Zone ==="
|
||||
# Attempt to parse the symlink at /etc/localtime
|
||||
# On many systems, /etc/localtime is a symlink to /usr/share/zoneinfo/Region/City
|
||||
if [ -L /etc/localtime ]; then
|
||||
local tz_target
|
||||
tz_target=$(readlink -f /etc/localtime)
|
||||
# Remove the /usr/share/zoneinfo/ part to display just Region/City
|
||||
local tz_name
|
||||
tz_name="${tz_target#/usr/share/zoneinfo/}"
|
||||
echo "Time zone: $tz_name"
|
||||
else
|
||||
# Some distros have /etc/localtime as a copy of the zone file
|
||||
# Try to read /etc/timezone as a fallback (Debian-based)
|
||||
if [ -f /etc/timezone ]; then
|
||||
echo "Time zone: $(cat /etc/timezone)"
|
||||
else
|
||||
echo "Time zone: Unknown (not a symlink, and /etc/timezone missing)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=== RTC in local TZ? ==="
|
||||
# If /etc/adjtime exists and the last line is "LOCAL", that typically indicates localtime
|
||||
# If it’s "UTC" or absent, the RTC is typically in UTC.
|
||||
if [ -f /etc/adjtime ]; then
|
||||
local rtc_mode
|
||||
rtc_mode=$(tail -n 1 /etc/adjtime)
|
||||
if [ "$rtc_mode" = "LOCAL" ]; then
|
||||
echo "RTC is in local time."
|
||||
else
|
||||
echo "RTC is in UTC."
|
||||
fi
|
||||
else
|
||||
echo "Cannot determine RTC mode (no /etc/adjtime)."
|
||||
fi
|
||||
echo
|
||||
echo "=== RTC in local TZ? ==="
|
||||
# If /etc/adjtime exists and the last line is "LOCAL", that typically indicates localtime
|
||||
# If it’s "UTC" or absent, the RTC is typically in UTC.
|
||||
if [ -f /etc/adjtime ]; then
|
||||
local rtc_mode
|
||||
rtc_mode=$(tail -n 1 /etc/adjtime)
|
||||
if [ "$rtc_mode" = "LOCAL" ]; then
|
||||
echo "RTC is in local time."
|
||||
else
|
||||
echo "RTC is in UTC."
|
||||
fi
|
||||
else
|
||||
echo "Cannot determine RTC mode (no /etc/adjtime)."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=== NTP Service Status ==="
|
||||
# Attempt to detect if systemd-timesyncd is enabled/active
|
||||
if command -v systemctl &>/dev/null; then
|
||||
if systemctl is-enabled systemd-timesyncd &>/dev/null; then
|
||||
echo "systemd-timesyncd service is enabled."
|
||||
else
|
||||
echo "systemd-timesyncd service is disabled."
|
||||
fi
|
||||
echo
|
||||
echo "=== NTP Service Status ==="
|
||||
# Attempt to detect if systemd-timesyncd is enabled/active
|
||||
if command -v systemctl &>/dev/null; then
|
||||
if systemctl is-enabled systemd-timesyncd &>/dev/null; then
|
||||
echo "systemd-timesyncd service is enabled."
|
||||
else
|
||||
echo "systemd-timesyncd service is disabled."
|
||||
fi
|
||||
|
||||
if systemctl is-active systemd-timesyncd &>/dev/null; then
|
||||
echo "systemd-timesyncd service is active (running)."
|
||||
else
|
||||
echo "systemd-timesyncd service is not running."
|
||||
fi
|
||||
else
|
||||
echo "systemctl is not available. Cannot determine NTP status this way."
|
||||
fi
|
||||
if systemctl is-active systemd-timesyncd &>/dev/null; then
|
||||
echo "systemd-timesyncd service is active (running)."
|
||||
else
|
||||
echo "systemd-timesyncd service is not running."
|
||||
fi
|
||||
else
|
||||
echo "systemctl is not available. Cannot determine NTP status this way."
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
}
|
||||
|
||||
set_time() {
|
||||
local new_time="$1"
|
||||
local new_time="$1"
|
||||
|
||||
if [ -z "$new_time" ]; then
|
||||
abort "Please specify a time, e.g. '2025-03-21 18:00:00'"
|
||||
fi
|
||||
if [ -z "$new_time" ]; then
|
||||
abort "Please specify a time, e.g. '2025-03-21 18:00:00'"
|
||||
fi
|
||||
|
||||
echo "Setting system time to: $new_time"
|
||||
# Using 'date' to set system time.
|
||||
# Format can be e.g. "YYYY-MM-DD HH:MM:SS"
|
||||
# Usually you need root privileges for this:
|
||||
if ! date -s "$new_time"; then
|
||||
abort "Failed to set system time. Check your permissions?"
|
||||
fi
|
||||
echo "Setting system time to: $new_time"
|
||||
# Using 'date' to set system time.
|
||||
# Format can be e.g. "YYYY-MM-DD HH:MM:SS"
|
||||
# Usually you need root privileges for this:
|
||||
if ! date -s "$new_time"; then
|
||||
abort "Failed to set system time. Check your permissions?"
|
||||
fi
|
||||
|
||||
# Also sync to hardware clock:
|
||||
if command -v hwclock &>/dev/null; then
|
||||
hwclock --systohc || echo "Warning: couldn't sync with HW clock."
|
||||
fi
|
||||
# Also sync to hardware clock:
|
||||
if command -v hwclock &>/dev/null; then
|
||||
hwclock --systohc || echo "Warning: couldn't sync with HW clock."
|
||||
fi
|
||||
}
|
||||
|
||||
list_timezones() {
|
||||
local zoneinfo_dir="/usr/share/zoneinfo"
|
||||
if [ ! -d "$zoneinfo_dir" ]; then
|
||||
abort "Cannot find $zoneinfo_dir directory."
|
||||
fi
|
||||
local zoneinfo_dir="/usr/share/zoneinfo"
|
||||
if [ ! -d "$zoneinfo_dir" ]; then
|
||||
abort "Cannot find $zoneinfo_dir directory."
|
||||
fi
|
||||
|
||||
echo "List of available time zones (under $zoneinfo_dir):"
|
||||
# We filter out possible files that are not real zone data.
|
||||
# On some systems, zone data might be in subdirectories (Region/City).
|
||||
find "$zoneinfo_dir" -type f | sed "s|^$zoneinfo_dir/||"
|
||||
echo "List of available time zones (under $zoneinfo_dir):"
|
||||
# We filter out possible files that are not real zone data.
|
||||
# On some systems, zone data might be in subdirectories (Region/City).
|
||||
find "$zoneinfo_dir" -type f | sed "s|^$zoneinfo_dir/||"
|
||||
}
|
||||
|
||||
set_timezone() {
|
||||
local tz="$1"
|
||||
local tz="$1"
|
||||
|
||||
if [ -z "$tz" ]; then
|
||||
abort "Please specify a time zone, e.g. 'America/New_York'"
|
||||
fi
|
||||
if [ -z "$tz" ]; then
|
||||
abort "Please specify a time zone, e.g. 'America/New_York'"
|
||||
fi
|
||||
|
||||
local zoneinfo_file="/usr/share/zoneinfo/$tz"
|
||||
if [ ! -f "$zoneinfo_file" ]; then
|
||||
abort "Time zone '$tz' not found under /usr/share/zoneinfo"
|
||||
fi
|
||||
local zoneinfo_file="/usr/share/zoneinfo/$tz"
|
||||
if [ ! -f "$zoneinfo_file" ]; then
|
||||
abort "Time zone '$tz' not found under /usr/share/zoneinfo"
|
||||
fi
|
||||
|
||||
echo "Linking /etc/localtime to $zoneinfo_file"
|
||||
ln -sf "$zoneinfo_file" /etc/localtime || abort "Failed to link /etc/localtime"
|
||||
echo "Linking /etc/localtime to $zoneinfo_file"
|
||||
ln -sf "$zoneinfo_file" /etc/localtime || abort "Failed to link /etc/localtime"
|
||||
|
||||
# Some distros use /etc/timezone to store the name of the current timezone
|
||||
if [ -w /etc/timezone ]; then
|
||||
echo "$tz" >/etc/timezone
|
||||
fi
|
||||
# Some distros use /etc/timezone to store the name of the current timezone
|
||||
if [ -w /etc/timezone ]; then
|
||||
echo "$tz" >/etc/timezone
|
||||
fi
|
||||
|
||||
echo "Time zone changed to $tz."
|
||||
echo "Time zone changed to $tz."
|
||||
}
|
||||
|
||||
set_local_rtc() {
|
||||
local is_local="$1"
|
||||
local is_local="$1"
|
||||
|
||||
if [ -z "$is_local" ]; then
|
||||
abort "Please specify 0 or 1. Example: set-local-rtc 1"
|
||||
fi
|
||||
if [ -z "$is_local" ]; then
|
||||
abort "Please specify 0 or 1. Example: set-local-rtc 1"
|
||||
fi
|
||||
|
||||
# We update /etc/adjtime accordingly:
|
||||
# - If local time: last line should be LOCAL
|
||||
# - If UTC: last line should be UTC
|
||||
# We also update the hardware clock accordingly.
|
||||
if [ "$is_local" = "1" ]; then
|
||||
echo "Configuring RTC to use local time."
|
||||
# "hwclock --localtime" is fairly ambiguous (it sets hardware clock from system time).
|
||||
# We use the below approach:
|
||||
hwclock --systohc --localtime || echo "Warning: couldn't set HW clock localtime."
|
||||
# Overwrite /etc/adjtime fully:
|
||||
cat <<EOF >/etc/adjtime
|
||||
# We update /etc/adjtime accordingly:
|
||||
# - If local time: last line should be LOCAL
|
||||
# - If UTC: last line should be UTC
|
||||
# We also update the hardware clock accordingly.
|
||||
if [ "$is_local" = "1" ]; then
|
||||
echo "Configuring RTC to use local time."
|
||||
# "hwclock --localtime" is fairly ambiguous (it sets hardware clock from system time).
|
||||
# We use the below approach:
|
||||
hwclock --systohc --localtime || echo "Warning: couldn't set HW clock localtime."
|
||||
# Overwrite /etc/adjtime fully:
|
||||
cat <<EOF >/etc/adjtime
|
||||
0.0 0 0.0
|
||||
0
|
||||
LOCAL
|
||||
EOF
|
||||
else
|
||||
echo "Configuring RTC to use UTC."
|
||||
hwclock --systohc --utc || echo "Warning: couldn't set HW clock to UTC."
|
||||
cat <<EOF >/etc/adjtime
|
||||
else
|
||||
echo "Configuring RTC to use UTC."
|
||||
hwclock --systohc --utc || echo "Warning: couldn't set HW clock to UTC."
|
||||
cat <<EOF >/etc/adjtime
|
||||
0.0 0 0.0
|
||||
0
|
||||
UTC
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
set_ntp() {
|
||||
local enable_ntp="$1"
|
||||
if ! command -v systemctl &>/dev/null; then
|
||||
echo "systemctl not available. Cannot manage systemd-timesyncd. Exiting."
|
||||
return 1
|
||||
fi
|
||||
local enable_ntp="$1"
|
||||
if ! command -v systemctl &>/dev/null; then
|
||||
echo "systemctl not available. Cannot manage systemd-timesyncd. Exiting."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# systemd-timesyncd is the typical built-in NTP client for systemd-based systems
|
||||
case "$enable_ntp" in
|
||||
true|True|1|on)
|
||||
echo "Enabling and starting systemd-timesyncd..."
|
||||
systemctl enable systemd-timesyncd || echo "Failed to enable timesyncd."
|
||||
systemctl start systemd-timesyncd || echo "Failed to start timesyncd."
|
||||
;;
|
||||
false|False|0|off)
|
||||
echo "Disabling and stopping systemd-timesyncd..."
|
||||
systemctl disable systemd-timesyncd || echo "Failed to disable timesyncd."
|
||||
systemctl stop systemd-timesyncd || echo "Failed to stop timesyncd."
|
||||
;;
|
||||
*)
|
||||
abort "Unknown argument '$enable_ntp'. Use 'true' or 'false'."
|
||||
;;
|
||||
esac
|
||||
# systemd-timesyncd is the typical built-in NTP client for systemd-based systems
|
||||
case "$enable_ntp" in
|
||||
true | True | 1 | on)
|
||||
echo "Enabling and starting systemd-timesyncd..."
|
||||
systemctl enable systemd-timesyncd || echo "Failed to enable timesyncd."
|
||||
systemctl start systemd-timesyncd || echo "Failed to start timesyncd."
|
||||
;;
|
||||
false | False | 0 | off)
|
||||
echo "Disabling and stopping systemd-timesyncd..."
|
||||
systemctl disable systemd-timesyncd || echo "Failed to disable timesyncd."
|
||||
systemctl stop systemd-timesyncd || echo "Failed to stop timesyncd."
|
||||
;;
|
||||
*)
|
||||
abort "Unknown argument '$enable_ntp'. Use 'true' or 'false'."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -226,43 +226,43 @@ set_ntp() {
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
main() {
|
||||
local cmd="$1"
|
||||
shift || true
|
||||
local cmd="$1"
|
||||
shift || true
|
||||
|
||||
case "$cmd" in
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
set-time)
|
||||
set_time "$@"
|
||||
;;
|
||||
set-timezone)
|
||||
set_timezone "$@"
|
||||
;;
|
||||
list-timezones)
|
||||
list_timezones
|
||||
;;
|
||||
set-local-rtc)
|
||||
set_local_rtc "$@"
|
||||
;;
|
||||
set-ntp)
|
||||
set_ntp "$@"
|
||||
;;
|
||||
""|help|--help|-h)
|
||||
print_usage
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: $cmd"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "$cmd" in
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
set-time)
|
||||
set_time "$@"
|
||||
;;
|
||||
set-timezone)
|
||||
set_timezone "$@"
|
||||
;;
|
||||
list-timezones)
|
||||
list_timezones
|
||||
;;
|
||||
set-local-rtc)
|
||||
set_local_rtc "$@"
|
||||
;;
|
||||
set-ntp)
|
||||
set_ntp "$@"
|
||||
;;
|
||||
"" | help | --help | -h)
|
||||
print_usage
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: $cmd"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
main "$@"
|
||||
if [ $# -lt 1 ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user