-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: Move common parts to library
- Loading branch information
Showing
7 changed files
with
88 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
info() | ||
{ | ||
echo "--- $*" | ||
} | ||
|
||
error() | ||
{ | ||
echo "=== ERROR: $*" >&2 | ||
} | ||
|
||
warning() | ||
{ | ||
echo "=== WARNING: $*" >&2 | ||
} | ||
|
||
die() | ||
{ | ||
error "$*" | ||
exit 1 | ||
} | ||
|
||
do_install() | ||
{ | ||
info "install $*" | ||
install "$@" || die "Failed install $*" | ||
} | ||
|
||
do_systemctl() | ||
{ | ||
info "systemctl $*" | ||
systemctl "$@" || die "Failed to systemctl $*" | ||
} | ||
|
||
do_chown() | ||
{ | ||
info "chown $*" | ||
chown "$@" || die "Failed to chown $*" | ||
} | ||
|
||
do_chmod() | ||
{ | ||
info "chmod $*" | ||
chmod "$@" || die "Failed to chmod $*" | ||
} | ||
|
||
try_systemctl() | ||
{ | ||
info "systemctl $*" | ||
systemctl "$@" 2>/dev/null | ||
} | ||
|
||
do_chown() | ||
{ | ||
info "chown $*" | ||
chown "$@" || die "Failed to chown $*" | ||
} | ||
|
||
do_chmod() | ||
{ | ||
info "chmod $*" | ||
chmod "$@" || die "Failed to chmod $*" | ||
} | ||
|
||
stop_services() | ||
{ | ||
try_systemctl stop letmeind.socket | ||
try_systemctl stop letmeind.service | ||
try_systemctl stop letmeinfwd.socket | ||
try_systemctl stop letmeinfwd.service | ||
try_systemctl disable letmeind.service | ||
try_systemctl disable letmeind.socket | ||
try_systemctl disable letmeinfwd.service | ||
try_systemctl disable letmeinfwd.socket | ||
} | ||
|
||
start_services() | ||
{ | ||
do_systemctl start letmeinfwd.socket | ||
do_systemctl start letmeinfwd.service | ||
do_systemctl start letmeind.socket | ||
do_systemctl start letmeind.service | ||
} |
File renamed without changes.