@@ -143,6 +143,12 @@ for f in "$GHE_BACKUP_CONFIG" "$GHE_BACKUP_ROOT/backup.config" \
143
143
fi
144
144
done
145
145
146
+ # If we don't have a readlink command, error out
147
+ ! type readlink 1> /dev/null 2>&1 && {
148
+ echo " Error: readlink not found. Please install readlink and ensure it is in your PATH." 1>&2
149
+ exit 1
150
+ }
151
+
146
152
GHE_RESTORE_IN_PROGRESS=$( readlink -fm " ${GHE_DATA_DIR} /in-progress-restore" )
147
153
GHE_BACKUP_IN_PROGRESS=$( readlink -fm " ${GHE_DATA_DIR} /in-progress-backup" )
148
154
@@ -294,10 +300,9 @@ if [ -z "$GHE_DATA_DIR" ]; then
294
300
fi
295
301
296
302
# Convert the data directory path to an absolute path, basing any relative
297
- # paths on the backup-utils root, and using readlink, if available, to
298
- # canonicalize the path.
303
+ # paths on the backup-utils root, and use readlink to canonicalize the path.
299
304
if [ " ${GHE_DATA_DIR: 0: 1} " != " /" ]; then
300
- GHE_DATA_DIR=" $( cd " $GHE_BACKUP_ROOT " && readlink -m " $GHE_DATA_DIR " 2> /dev/null || echo " $GHE_BACKUP_ROOT / $GHE_DATA_DIR " ) "
305
+ GHE_DATA_DIR=" $( cd " $GHE_BACKUP_ROOT " && readlink -m " $GHE_DATA_DIR " ) "
301
306
fi
302
307
export GHE_DATA_DIR
303
308
@@ -401,17 +406,6 @@ ghe_remote_version_config() {
401
406
# ##############################################################################
402
407
# ## Utility functions
403
408
404
- # If we don't have a readlink command, parse ls -l output.
405
- if ! type readlink 1> /dev/null 2>&1 ; then
406
- readlink () {
407
- if [ -x " $1 " ]; then
408
- ls -ld " $1 " | sed ' s/.*-> //'
409
- else
410
- return 1
411
- fi
412
- }
413
- fi
414
-
415
409
# Run ghe-host-check and establish the version of the remote GitHub instance in
416
410
# the exported GHE_REMOTE_VERSION variable. If the remote version has already
417
411
# been established then don't perform the host check again. Utilities in share/github-backup-utils
0 commit comments