Skip to content

Commit

Permalink
Merge pull request #19 from JedMeister/fix-fixclock-hook
Browse files Browse the repository at this point in the history
Bugfix fixclock-hook - closes #1910
  • Loading branch information
JedMeister committed Mar 14, 2024
2 parents 131a741 + f0c9f5d commit ec65887
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
6 changes: 3 additions & 3 deletions contrib/cron.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set "${JITTER:=3600}"

Expand All @@ -11,12 +11,12 @@ randomsleep() {
# A fix for shells that do not have this bash feature.
RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5")
fi
TIME=$(($RANDOM % $MAXSLEEP))
TIME=$((RANDOM % MAXSLEEP))
sleep $TIME
fi
fi
}

# prevent everyone from hitting the Hub API at exactly the same time...
randomsleep $JITTER
randomsleep "$JITTER"
tklbam-backup --quiet
1 change: 0 additions & 1 deletion contrib/example-conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ backup-skip-database False

restore-cache-size 50%
restore-cache-dir /var/cache/tklbam/restore

10 changes: 4 additions & 6 deletions contrib/example-overrides
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@
#
# Examples
#
# (exclude Drupal6 sessions table)
# -mysql:drupal6/sessions
# (exclude Drupal10 sessions table)
# -mysql:drupal10/sessions
#
# (only include drupal6 database)
# mysql:drupal6


# (only include drupal10 database)
# mysql:drupal10
22 changes: 11 additions & 11 deletions contrib/ez-apt-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# script adds the correct apt source and installs package
# Author: Liraz Siri <liraz@turnkeylinux.org>

fatal() { echo "FATAL: $@" >&2; exit 1; }
info() { echo "INFO: $@"; }
fatal() { echo "FATAL: $*" >&2; exit 1; }
info() { echo "INFO: $*"; }

[[ -z "$DEBUG" ]] || set -x

Expand All @@ -16,7 +16,7 @@ get_debian_dist() {
10.*) echo buster ;;
11.*) echo bullseye ;;
12.*) echo bookworm ;;
*/*) echo $1 | sed 's|/.*||' ;;
*/*) echo "$1" | sed 's|/.*||' ;;
esac
}

Expand Down Expand Up @@ -55,29 +55,29 @@ if [[ "$APT_KEY_URL" == *.asc ]]; then
apt-get update
apt-get install -y --no-install-recommends gpg
fi
tmp_file=/tmp/$(basename $APT_KEY_URL)
tmp_file=/tmp/$(basename "$APT_KEY_URL")
elif [[ "$APT_KEY_URL" == *.gpg ]]; then
tmp_file=''
else
error "APT_KEY_URL does not appear to be a GPG file (should end with .gpg or .asc)"
fi

if ! rgrep . /etc/apt/sources.list* | sed 's/#.*//' | grep -q $APT_URL; then
if ! rgrep . /etc/apt/sources.list* | sed 's/#.*//' | grep -q "$APT_URL"; then

apt_name=$(echo $APT_URL | sed 's|.*//||; s|/.*||')
apt_name=$(echo "$APT_URL" | sed 's|.*//||; s|/.*||')
apt_file="/etc/apt/sources.list.d/${apt_name}.list"

echo "deb [signed-by=/$KEY_FILE] $APT_URL $deb_dist main" > $apt_file
echo "deb [signed-by=/$KEY_FILE] $APT_URL $deb_dist main" > "$apt_file"

info "downloading $APT_KEY_URL"
local_file=/$KEY_FILE
if [[ -n "$tmp_file" ]]; then
local_file=$tmp_file
fi
wget -O $local_file $APT_KEY_URL
wget -O "$local_file" "$APT_KEY_URL"
if [[ -n "$tmp_file" ]]; then
gpg -o /$KEY_FILE --dearmor $tmp_file
rm -f $tmp_file
gpg -o "/$KEY_FILE" --dearmor "$tmp_file"
rm -f "$tmp_file"
fi
info "Added $APT_URL package source to $apt_file"
fi
Expand All @@ -87,5 +87,5 @@ apt-get update \
|| fatal "Command fialed. Please report to TurnKey Linux."

info "Installing $PACKAGE"
apt-get install $PACKAGE \
apt-get install "$PACKAGE" \
|| fatal "Package install failed, please report to TurnKe Linux."
1 change: 1 addition & 0 deletions contrib/fixclock-hook
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import sys
import subprocess
import shutil
from string import Template
from typing import Optional

NTPSERVER = os.environ.get("NTPSERVER", "2.pool.ntp.org")

Expand Down

0 comments on commit ec65887

Please sign in to comment.