Skip to content

Commit 134a61b

Browse files
committed
Merge branch 'master' into krayon-shellcheck-p2
2 parents 2273d84 + 93ca1b6 commit 134a61b

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

share/github-backup-utils/ghe-backup-config

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \
165165
fi
166166
done
167167

168+
# If we don't have a readlink command, error out
169+
! type readlink 1>/dev/null 2>&1 && {
170+
echo "Error: readlink not found. Please install readlink and ensure it is in your PATH." 1>&2
171+
exit 1
172+
}
173+
168174
GHE_RESTORE_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-restore")
169175
GHE_BACKUP_IN_PROGRESS=$(readlink -fm "${GHE_DATA_DIR}/in-progress-backup")
170176

@@ -317,10 +323,9 @@ if [ -z "$GHE_DATA_DIR" ]; then
317323
fi
318324

319325
# Convert the data directory path to an absolute path, basing any relative
320-
# paths on the backup-utils root, and using readlink, if available, to
321-
# canonicalize the path.
326+
# paths on the backup-utils root, and use readlink to canonicalize the path.
322327
if [ "${GHE_DATA_DIR:0:1}" != "/" ]; then
323-
GHE_DATA_DIR="$(cd "$GHE_BACKUP_ROOT" && readlink -m "$GHE_DATA_DIR" 2>/dev/null || echo "$GHE_BACKUP_ROOT/$GHE_DATA_DIR")"
328+
GHE_DATA_DIR="$(cd "$GHE_BACKUP_ROOT" && readlink -m "$GHE_DATA_DIR")"
324329
fi
325330
export GHE_DATA_DIR
326331

share/github-backup-utils/ghe-backup-settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ backup-secret "kredz.credz HMAC key" "kredz-credz-hmac" "secrets.kredz.credz-hma
8080
backup-secret "kredz.varz HMAC key" "kredz-varz-hmac" "secrets.kredz.varz-hmac-secret"
8181

8282
# Backup argon secrets for multiuser from ghes version 3.8 onwards
83-
if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then
83+
if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then
8484
backup-secret "management console argon2 secret" "manage-argon-secret" "secrets.manage-auth.argon-secret"
8585
fi
8686

test/test-ghe-backup.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,18 @@ begin_test "ghe-backup without password pepper"
133133
)
134134
end_test
135135

136-
begin_test "ghe-backup without management console argon2 secret for ghes lower than 3.8"
136+
# before the introduction of multiuser auth
137+
begin_test "ghe-backup management console does not backup argon secret"
137138
(
138139
set -e
139140

140-
git config -f "$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf" secrets.manage-auth.argon-secret "fake pw"
141-
GHE_REMOTE_VERSION=3.7.0 ghe-backup
142-
141+
GHE_REMOTE_VERSION=3.7.0 ghe-backup -v | grep -q "management console argon2 secret not set" && exit 1
143142
[ ! -f "$GHE_DATA_DIR/current/manage-argon-secret" ]
144143
)
145144
end_test
146145

147146
# multiuser auth introduced in ghes version 3.8
148-
begin_test "ghe-backup management console argon2 secret"
147+
begin_test "ghe-backup management console backs up argon secret"
149148
(
150149
set -e
151150

test/testlib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ verify_all_backedup_data() {
448448
[ "$(cat "$GHE_DATA_DIR/current/manage-password")" = "fake password hash data" ]
449449

450450
# verify manage-argon-secret file was backed up
451-
if [ "$(version $GHE_REMOTE_VERSION)" -gt "$(version 3.7.0)" ]; then
451+
if ! [ "$(version $GHE_REMOTE_VERSION)" -lt "$(version 3.8.0)" ]; then
452452
[ "$(cat "$GHE_DATA_DIR/current/manage-argon-secret")" = "fake argon2 secret" ]
453453
fi
454454

0 commit comments

Comments
 (0)