From 96283c7bb7c2b9aac7c4fa900636a017001c99f4 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 16 Sep 2021 03:42:03 +0200 Subject: Install fix --- Makefile | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4dd9a31..66da002 100644 --- a/Makefile +++ b/Makefile @@ -9,28 +9,42 @@ install: # Install to ${DIR_INSTALL_PATH} mkdir -p ${DIR_INSTALL_PATH} @ echo '' + # Copy code then assets cp -u *.py ${DIR_INSTALL_PATH}/ cp -r download ${DIR_INSTALL_PATH}/download cp -r assets ${DIR_INSTALL_PATH}/assets @[ -f frwiktionary-latest-pages-meta-current.xml.bz2 ] && \ - cp -u frwiktionary-latest-pages-meta-current.xml.bz2 ${DIR_INSTALL_PATH}/ || true - # + cp -u frwiktionary-latest-pages-meta-current.xml.bz2 ${DIR_INSTALL_PATH}/ \ + || printf "No previous dump found" + # Disabled DEBUG in production sed -i 's/DEBUG = True/DEBUG = False/' ${DIR_INSTALL_PATH}/*.py + @ echo '' + # Get the external assets if needed cd ${DIR_INSTALL_PATH}; python ${DIR_INSTALL_PATH}/download/download.py -d -o "${DIR_INSTALL_PATH}/assets/dfr.db" + @ echo '' + # Set permission and install command chmod +x ${DIR_INSTALL_PATH}/dfr.py + chmod +x ${DIR_INSTALL_PATH}/dfrf.py + @ echo '' + # delete symlink if it exists - [ -h ${DIR_BIN}/dfr ] && unlink ${DIR_BIN}/dfr - # create it + @-[ -h ${DIR_BIN}/dfr ] && unlink ${DIR_BIN}/dfr || true + @-[ -h ${DIR_BIN}/dfr ] && unlink ${DIR_BIN}/dfrf || true + @ echo '' + + # then create it ln -s ${DIR_INSTALL_PATH}/dfr.py ${DIR_BIN}/dfr + ln -s ${DIR_INSTALL_PATH}/dfrf.py ${DIR_BIN}/dfrf chmod +x ${DIR_BIN}/dfr @echo 'Enjoy dfr !' uninstall: - rm -R ${DIR_INSTALL_PATH} - unlink ${DIR_BIN}/dfr + -rm -Rf ${DIR_INSTALL_PATH} + -unlink ${DIR_BIN}/dfr + -unlink ${DIR_BIN}/dfrf @echo 'Have a nice day ! 👋' -- cgit v1.2.3