#!/bin/bash

## Copyright (C) 2017 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
shopt -s inherit_errexit
shopt -s shift_verbose

if [ ! "$(id -u)" = "0" ]; then
    printf '%s\n' "$0: ERROR: Must be run as root (sudo)!"
    exit 1
fi

## If this script is run as root.
safe-rm --force -- /run/anondate/tor_certificate_lifetime_set
## If this script is run under account 'sdwdate'.
safe-rm --force -- /run/sdwdate/tor_certificate_lifetime_set

safe-rm --force -- /run/sdwdate/first_success
safe-rm --force -- /run/sdwdate/clock_jump_do_once

leaprun sdwdate-clock-jump-do-once-file-create

leaprun restart-sdwdate

true "$0: OK"
