post_install() { cd /opt/kmeldb-ui chmod 755 ./kenwooddbgen.sh # creating __pycache__ folders and adding proper permissions so that Python can generate # compiled bytecode running under standard user account mkdir ./__pycache__ chmod 777 ./__pycache__ mkdir ./kmeldb_cli/kmeldb/__pycache__ chmod 777 ./kmeldb_cli/kmeldb/__pycache__ cd - } pre_remove() { # Some files (generated by postinstall, for example) are left. # We need to clean the mess. [ -d /opt/kmeldb-ui/__pycache__ ] && rm -r /opt/kmeldb-ui/__pycache__ [ -d /opt/kmeldb-ui/kmeldb_cli/kmeldb/__pycache__ ] && rm -r /opt/kmeldb-ui/kmeldb_cli/kmeldb/__pycache__ }