DIR_INSTALL_PATH=/usr/share/dfr DIR_BIN=/usr/sbin install: # Testing root @[ "$(shell id -u)" = 0 ] || echo "You *may need root* to run that target" @[ ! "$(shell id -u)" = 0 ] || echo "You are root" # 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}/ # # Disabled DEBUG in production sed -i 's/DEBUG = True/DEBUG = False/' ${DIR_INSTALL_PATH}/*.py # 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" # Set permission and install command chmod +x ${DIR_INSTALL_PATH}/dicofr.py # delete symlink if it exists [ -h ${DIR_BIN}/dfr ] && unlink ${DIR_BIN}/dfr # create it ln -s ${DIR_INSTALL_PATH}/dicofr.py ${DIR_BIN}/dfr chmod +x ${DIR_BIN}/dfr @echo 'Enjoy dfr !' uninstall: rm -R ${DIR_INSTALL_PATH} unlink ${DIR_BIN}/dfr @echo 'Have a nice day ! 👋'