description "Welcome to Ubuntu" author "Michael Terry " start on starting unity8 task expect stop # If you change this, also change it in the cleanup upstart job env RUN_FILE=".config/ubuntu-system-settings/wizard-has-run" pre-start script if [ -e "$HOME/$RUN_FILE" ]; then initctl set-env WIZARD_SKIPPED=true stop else # Stop unity8, we'll start it again in post-stop (this avoids a race # between post-stop and unity8 unpausing) stop --no-wait $JOB # Tell unity-mir to raise SIGSTOP after we start initctl set-env UNITY_MIR_EMITS_SIGSTOP=1 if [ -n "$MIR_SOCKET" ]; then initctl set-env --global WIZARD_ORIG_MIR_SOCKET=$MIR_SOCKET # Point wizard at unity-system-compositor MIR_SERVER_FILE=$XDG_RUNTIME_DIR/wizard_socket initctl set-env MIR_SERVER_FILE=$MIR_SERVER_FILE initctl set-env MIR_SERVER_HOST_SOCKET=$MIR_SOCKET # Remove the socket if still there if [ -S "$MIR_SERVER_FILE" ]; then rm "$MIR_SERVER_FILE" fi # Point future jobs in this session to our Mir socket instead of # unity-system-compositor's socket. initctl set-env --global MIR_SOCKET=$MIR_SERVER_FILE gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}" fi fi end script exec system-settings-wizard post-stop script if [ -n "$WIZARD_SKIPPED" ]; then exit fi setenv() { initctl set-env --global $1=$2 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'$1': '$2'}" } echo "Ending wizard" if [ -S "$MIR_SERVER_FILE" ]; then rm -f "$MIR_SERVER_FILE" fi # Undo changes to global variables if [ -n "$WIZARD_ORIG_MIR_SOCKET" ]; then echo "Resetting MIR_SOCKET to $WIZARD_ORIG_MIR_SOCKET" setenv MIR_SOCKET $WIZARD_ORIG_MIR_SOCKET fi # Stop any indicators and OSK so they will be restarted with new environment initctl emit indicator-services-end stop maliit-server || true # And finally, resume unity8 start --no-wait $JOB || true end script