Setting LOGFILE to a file in root directory wipes everything
clean.sh picks the parent of LOGFILE and wipes it clean! So if you set it to a log file in the users root directory, you lose everything We should delete just the LOGFILE and cleanup LOGDIR and SCREEN_LOGDIR if they are explicitly set. Change-Id: I45745427dcaed3dcf0b78cc9ed680833d9d555e8
This commit is contained in:
13
clean.sh
13
clean.sh
@@ -114,9 +114,16 @@ sudo rm -f /etc/tgt/conf.d/*
|
|||||||
cleanup_rpc_backend
|
cleanup_rpc_backend
|
||||||
cleanup_database
|
cleanup_database
|
||||||
|
|
||||||
# Clean out data, logs and status
|
# Clean out data and status
|
||||||
LOGDIR=$(dirname "$LOGFILE")
|
sudo rm -rf $DATA_DIR $DEST/status
|
||||||
sudo rm -rf $DATA_DIR $LOGDIR $DEST/status
|
|
||||||
|
# Clean out the log file and log directories
|
||||||
|
if [[ -n "$LOGFILE" ]] && [[ -f "$LOGFILE" ]]; then
|
||||||
|
sudo rm -f $LOGFILE
|
||||||
|
fi
|
||||||
|
if [[ -n "$LOGDIR" ]] && [[ -d "$LOGDIR" ]]; then
|
||||||
|
sudo rm -rf $LOGDIR
|
||||||
|
fi
|
||||||
if [[ -n "$SCREEN_LOGDIR" ]] && [[ -d "$SCREEN_LOGDIR" ]]; then
|
if [[ -n "$SCREEN_LOGDIR" ]] && [[ -d "$SCREEN_LOGDIR" ]]; then
|
||||||
sudo rm -rf $SCREEN_LOGDIR
|
sudo rm -rf $SCREEN_LOGDIR
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user