UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    SystemD service to auto-mount the Waydroid folder on UT side

    Scheduled Pinned Locked Moved Waydroid
    1 Posts 1 Posters 13 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • SentinelS Offline
        Sentinel
        last edited by Sentinel

        @projectmoon said in Smooth Edges (name pending) - Let's Fix the Bugs That Drive You Mad:

        @Sentinel said:

        Lack of easy access to Waydroid files (and Waydroid not having easy access to any UT files) is kind of a big issue. I've created a SystemD service to auto-mount the Waydroid folder on UT side, but most people won't be able to do that.

        Could you share that system unit in another topic maybe? 😄

        I'm embarrassed to make a thread for such a small thing, especially as I'm sure other people must have done better jobs than my quick hack. But since you asked, here are the contents of the files I created to do this:

        phablet@ubuntu-phablet:~$ ll /etc/systemd/system/autostart.service /home/phablet/.autostart /home/phablet/Scripts/Mount_WaydroidHome.sh
        -rw-r--r-- 1 root    root    156 Oct 22 22:24 /etc/systemd/system/autostart.service
        -rw-r--r-- 1 phablet phablet  57 Oct 22 22:29 /home/phablet/.autostart
        -rwxrw-r-- 1 phablet phablet 243 Dec 13 18:53 /home/phablet/Scripts/Mount_WaydroidHome.sh*
        phablet@ubuntu-phablet:~$ cat /etc/systemd/system/autostart.service
        [Unit]
        Description=Autostart user-defined script on boot
        
        [Service]
        ExecStart=/usr/bin/bash /home/phablet/.autostart
        
        [Install]
        WantedBy=multi-user.target
        
        phablet@ubuntu-phablet:~$ cat /home/phablet/.autostart
        #!/bin/bash
        /home/phablet/Scripts/Mount_WaydroidHome.sh
        
        phablet@ubuntu-phablet:~$ cat /home/phablet/Scripts/Mount_WaydroidHome.sh
        #!/bin/bash
        #mkdir ~/WaydroidHome
        #chmod 755 ~/WaydroidHome
        #sudo chmod 777 ~/.local/share/waydroid/data/media/0
        /usr/bin/mount --bind /home/phablet/.local/share/waydroid/data/media/0 /home/phablet/WaydroidHome
        #sudo chmod 755 ~/WaydroidHome
        

        I'm intentionally not providing precise instructions on how to install these files, because if you don't know enough to do that, then you probably shouldn't be messing about with this stuff in the first place.

        But as the #comments of the last script hint, you need to run these commands once before it will work:

        mkdir ~/WaydroidHome
        chmod 755 ~/WaydroidHome
        sudo chmod 777 ~/.local/share/waydroid/data/media/0
        

        And if you still can't access anything after it's mounted, then you MIGHT need to run this command once (I ran it once but not sure if it was really needed):

        sudo chmod 755 ~/WaydroidHome
        

        WARNING: The above scripts work for me, but I haven't tested it thoroughly, or even for that long, and it may contain security flaws. It is (as I said before) just a 'quick hack'. In the spirit of open source, I hope other people will provide improvements to it.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post