pre_install() { useradd -r mycroft-core -b /usr/share } post_install() { chown -R mycroft-core:mycroft-core /usr/share/mycroft-core touch /usr/share/mycroft-core/.bashrc echo "# Virtualenv initialization" >> /usr/share/mycroft-core/.bashrc echo "export WORKON_HOME=\$HOME/.virtualenvs" >> /usr/share/mycroft-core/.bashrc echo "export PROJECT_HOME=\$HOME/Devel" >> /usr/share/mycroft-core/.bashrc echo "source /usr/bin/virtualenvwrapper.sh" >> /usr/share/mycroft-core/.bashrc sudo -u mycroft-core bash -c 'source ~/.bashrc' &> /dev/null # Initialize virtualenv sudo -u mycroft-core bash -c 'source ~/.bashrc && mkvirtualenv mycroft --system-site-packages -p $(which python2)' sudo -u mycroft-core bash -c 'source ~/.bashrc && workon mycroft && pip install -r /usr/share/mycroft-core/requirements.txt' echo "*** ATTENTION ***" echo "" echo "* The users who will use Mycroft need to be part of the mycroft-core group" echo "" echo "* You can configure your Mycroft instance preferences systemwide at:" echo " /usr/share/mycroft-core/mycroft/configuration/mycroft.conf" echo "" echo "* The systemd units are" echo " - mycroft.target" echo " - mycroft-service.service" echo " - mycroft-skills.service" echo " - mycroft-voice.service" echo "" echo "* Those are USER units which you can start issuing:" echo " systemctl --user start mycroft.target" echo " More information at: https://wiki.archlinux.org/index.php/Systemd/User" } post_upgrade() { chown -R mycroft-core:mycroft-core /usr/share/mycroft-core sudo -u mycroft-core bash -c "source ~/.bashrc && workon mycroft && pip install -r /usr/share/mycroft-core/requirements.txt" echo "*** ATTENTION ***" echo "" echo "* Upgrading to version v0.8.0 without repairing requires to each of Mycroft's user to run:" echo " cp ~/.mycroft/identity/identity.json ~/.mycroft/identity/identity2.json" } post_remove() { userdel mycroft-core rm -rf /usr/share/mycroft-core }