Archived
Prepare KarlDNS production deployment
This commit is contained in:
1 parent
5a90bd9d87
commit
ce5b4e0ff2
101 files changed
+3364
-2018
No files matched your search
@@ -48,6 +48,33 @@ remove_user() {
|
||||
fi
|
||||
}
|
||||
|
||||
remove_marked_crontab_file() {
|
||||
cron_file="$1"
|
||||
[ -f "$cron_file" ] || return 0
|
||||
tmp_file="$(mktemp)"
|
||||
awk '
|
||||
$0 == "# karldns-update start" {skip = 1; next}
|
||||
$0 == "# karldns-update end" {skip = 0; next}
|
||||
skip != 1 {print}
|
||||
' "$cron_file" > "$tmp_file"
|
||||
cat "$tmp_file" > "$cron_file"
|
||||
rm -f "$tmp_file"
|
||||
}
|
||||
|
||||
remove_marked_root_crontab() {
|
||||
if ! command -v crontab >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
tmp_file="$(mktemp)"
|
||||
crontab -l 2>/dev/null | awk '
|
||||
$0 == "# karldns-update start" {skip = 1; next}
|
||||
$0 == "# karldns-update end" {skip = 0; next}
|
||||
skip != 1 {print}
|
||||
' > "$tmp_file" || true
|
||||
crontab "$tmp_file"
|
||||
rm -f "$tmp_file"
|
||||
}
|
||||
|
||||
remove_system() {
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "System uninstall needs root. Re-run with sudo or set --mode user." >&2
|
||||
@@ -55,6 +82,8 @@ remove_system() {
|
||||
fi
|
||||
|
||||
rm -f /etc/cron.d/karldns-updater /usr/local/bin/karldns-update
|
||||
remove_marked_crontab_file /etc/crontabs/root
|
||||
remove_marked_root_crontab
|
||||
if [ "$KARLDNS_DELETE_CONFIG" = "1" ]; then
|
||||
rm -rf /etc/karldns /var/cache/karldns
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user