clear-config.sh now works with a secondary disk (#5135)

This commit is contained in:
Michael Vines 2019-07-16 19:09:14 -07:00 committed by GitHub
parent 94db9cd412
commit 349e5001d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -11,7 +11,9 @@ set -e
for i in "$SOLANA_RSYNC_CONFIG_DIR" "$SOLANA_CONFIG_DIR"; do
echo "Cleaning $i"
rm -rvf "${i:?}/" # <-- $i might be a symlink, rm the other side of it first
rm -rvf "$i"
mkdir -p "$i"
done
setup_secondary_mount

View File

@ -72,13 +72,16 @@ SOLANA_RSYNC_CONFIG_DIR=$SOLANA_ROOT/config
# Configuration that remains local
SOLANA_CONFIG_DIR=$SOLANA_ROOT/config-local
# If there is a secondary disk, symlink the config-local dir there
SECONDARY_DISK_MOUNT_POINT=/mnt/extra-disk
if [[ -d $SECONDARY_DISK_MOUNT_POINT ]]; then
mkdir -p $SECONDARY_DISK_MOUNT_POINT/config-local
mkdir -p "$SOLANA_ROOT"
ln -s $SECONDARY_DISK_MOUNT_POINT/config-local "$SOLANA_ROOT"
fi
setup_secondary_mount() {
# If there is a secondary disk, symlink the config-local dir there
if [[ -d $SECONDARY_DISK_MOUNT_POINT ]]; then
mkdir -p $SECONDARY_DISK_MOUNT_POINT/config-local
rm -rf "$SOLANA_CONFIG_DIR"
ln -sfT $SECONDARY_DISK_MOUNT_POINT/config-local "$SOLANA_CONFIG_DIR"
fi
}
setup_secondary_mount
default_arg() {
declare name=$1