data-path-fix: update for fresh installs

Don't require the database and gcode paths to exist.  Fall back on the
default location if they do not.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-10-16 07:53:51 -04:00
parent 7e35e54a71
commit 06279d0e10
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 2 additions and 4 deletions

View File

@ -11,10 +11,8 @@ GCODE_PATH="${HOME}/gcode_files"
MOOONRAKER_CONF="${CONFIG_PATH}/moonraker.conf" MOOONRAKER_CONF="${CONFIG_PATH}/moonraker.conf"
MOONRAKER_LOG="${LOG_PATH}/moonraker.log" MOONRAKER_LOG="${LOG_PATH}/moonraker.log"
[ ! -d "${DB_PATH}" ] && echo "Error: unable to find database: ${DB_PATH}" && exit 1
[ ! -f "${MOOONRAKER_CONF}" ] && echo "Error: unable to find config: ${MOOONRAKER_CONF}" && exit 1 [ ! -f "${MOOONRAKER_CONF}" ] && echo "Error: unable to find config: ${MOOONRAKER_CONF}" && exit 1
[ ! -d "${LOG_PATH}" ] && echo "Error: unable to find log path: ${LOG_PATH}" && exit 1 [ ! -d "${LOG_PATH}" ] && echo "Error: unable to find log path: ${LOG_PATH}" && exit 1
[ ! -d "${GCODE_PATH}" ] && echo "Error: unable to find gcode path: ${GCODE_PATH}" && exit 1
sudo systemctl stop moonraker sudo systemctl stop moonraker
@ -24,8 +22,8 @@ sudo systemctl stop moonraker
mkdir ${DATA_PATH} mkdir ${DATA_PATH}
echo "Creating symbolic links..." echo "Creating symbolic links..."
ln -s ${DB_PATH} "$DATA_PATH/database" [ -f "${DB_PATH}/data.mdb" ] && ln -s ${DB_PATH} "$DATA_PATH/database"
ln -s ${GCODE_PATH} "$DATA_PATH/gcodes" [ -d "${GCODE_PATH}" ] && ln -s ${GCODE_PATH} "$DATA_PATH/gcodes"
ln -s ${LOG_PATH} "$DATA_PATH/logs" ln -s ${LOG_PATH} "$DATA_PATH/logs"
ln -s ${CONFIG_PATH} "$DATA_PATH/config" ln -s ${CONFIG_PATH} "$DATA_PATH/config"