After switching my phone from a Jolla 1 to an Xperia X, I had to reenable the ability to allow the Situations app to turn on and off the airplane mode. I collected all the pieces from the together.jolla.com blog to provide a guide.
Summary of what the detailed commands do:
- Enable Developer mode under Preferences -> Developer tools. You are prompted for your phone pin.
- Open the newly installed application Terminal
- install sudo
- allow the user nemo to call the tool connmanctl via sudo without a password
- create a command line situation within Situations
The detailed commands to install sudo (step 2 from above). Type them in the terminal app:
[root@Sailfish ~]$ devel-su
ssu ar mer-tools
[root@Sailfish ~]$ pkcon refresh
[root@Sailfish ~]$ pkcon install sudo #answer questions with y for yes
The detailed command to allow the user nemo to call the tool connmanctl (step 3 from above). Type them in the terminal app:
[root@Sailfish ~]$ EDITOR=/bin/vi visudo -f /etc/sudoers.d/nemo-settings
This opens the editor vi. Press the key “i” to be able to input text. and type the following:
nemo ALL = (ALL) NOPASSWD: /usr/bin/connmannctl
Press “ESC” and type “:wq” to save and quit vi. Visudo will not save the file if you have syntax errors. It will tell you and allows you to re-edit by pressing “e”.
Test the changes by typing exit in the terminal. You should be still in the terminal app. Type the following to put the phone in airplane mode and back.
[nemo@Sailfish ~]$ connmanctl enable offline
[nemo@Sailfish ~]$ connmanctl disable offline
Now you can add a situation to the Situations app. I have a situation that activates every day from 1am to 6am and calls the following command on situation start:
connmanctl enable offline
and the following command on situation finish:
connmanctl disable offline
install sudo on sailfish: https://together.jolla.com/question/44012/how-to-use-sudo/?answer=44013#post-id-44013
connmanctl commands: https://together.jolla.com/question/172269/xperia-x-situations-app/?answer=179051#post-id-179051
sudoers syntax: https://help.ubuntu.com/community/Sudoers