diff options
author | ache <ache@ache.one> | 2021-08-31 08:21:42 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2021-08-31 08:21:42 +0200 |
commit | eed13c1b587c292f86d4b302918418ce78637126 (patch) | |
tree | a2c008669214d2e9122c1d5b33c1bf079d9b4ecd /Makefile | |
parent | Fix argument name (diff) |
Create a new database
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -1,21 +1,33 @@ -DIR_INSTALL_PATH=/usr/share/dfr/ -DIR_BIN=/usr/sbin/ +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} - # Copy everything to ${DIR_INSTALL_PATH} - cp -u *.py ${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 to production + # Disabled DEBUG in production sed -i 's/DEBUG = True/DEBUG = False/' ${DIR_INSTALL_PATH}/*.py - # Get the external assets - cd ${DIR_INSTALL_PATH}; python ${DIR_INSTALL_PATH}/download/download.py -d -o "${DIR_INSTALL_PATH}/assets/dicofr.db" + # 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 || sudo chmod +x ${DIR_INSTALL_PATH}/dicofr.py - ln -s ${DIR_INSTALL_PATH}/dicofr.py ${DIR_BIN}/dfr || sudo ln -s ${DIR_INSTALL_PATH}/dicofr.py ${DIR_BIN}/dfr - chmod +x ${DIR_BIN}/dfr || sudo chmod +x ${DIR_BIN}/dfr + 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} |