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

    How to detect Ubuntu Touch using system variables in shell script?

    Scheduled Pinned Locked Moved Support
    8 Posts 5 Posters 453 Views 2 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.
      • GermanAizekG Offline
        GermanAizek
        last edited by

        I'm writing shell script and I don't know how to make conditional block for ubuntu desktop or ubuntu touch, repositories are added for desktop and they are not working on ubtouch.

        Xiaomi Redmi Note 7.... And more...
        I have too many devices...

        lduboeufL M 2 Replies Last reply Reply Quote 0
        • lduboeufL Offline
          lduboeuf @GermanAizek
          last edited by

          @GermanAizek said in How to detect Ubuntu Touch using system variables in shell script?:

          I'm writing shell script and I don't know how to make conditional block for ubuntu desktop or ubuntu touch, repositories are added for desktop and they are not working on ubtouch.

          Maybe just by en vars ?
          e.g DESKTOP_SESSION , XDG_SESSION_DESKTOP

          GermanAizekG 1 Reply Last reply Reply Quote 0
          • GermanAizekG Offline
            GermanAizek @lduboeuf
            last edited by GermanAizek

            @lduboeuf

            phablet@ubuntu-phablet:/tmp$ debian@gdeb:~/GIT$ sudo adb shell
            [sudo] password for debian: 
            phablet@ubuntu-phablet:~$ echo $DESKTOP_SESSION
            
            phablet@ubuntu-phablet:~$ echo $XDG_SESSION_DESKTOP
            
            phablet@ubuntu-phablet:~$ echo "$DESKTOP_SESSION"
            
            phablet@ubuntu-phablet:~$ echo "$XDG_SESSION_DESKTOP"
            
            phablet@ubuntu-phablet:~$ echo "${XDG_SESSION_DESKTOP}"
            
            phablet@ubuntu-phablet:~$ echo "${DESKTOP_SESSION}"
            
            phablet@ubuntu-phablet:~$ sudo echo "${DESKTOP_SESSION}"
            [sudo] password for phablet: 
            
            
            

            They're empty.

            Xiaomi Redmi Note 7.... And more...
            I have too many devices...

            alan_gA 1 Reply Last reply Reply Quote 0
            • alan_gA Offline
              alan_g @GermanAizek
              last edited by

              @GermanAizek they wouldn't be empty run from the Terminal app. You might think it obvious you wanted to use adb shell but you didn't tell us.

              How about checking ${USER} for "phablet"?

              GermanAizekG 1 Reply Last reply Reply Quote 1
              • GermanAizekG Offline
                GermanAizek @alan_g
                last edited by

                How about checking ${USER} for "phablet"?

                @alan_g, it's a good solution, but it's unreliable, no one knows when will add ability in ubuntu touch to change user name during fresh installation.

                Xiaomi Redmi Note 7.... And more...
                I have too many devices...

                arubislanderA 1 Reply Last reply Reply Quote 0
                • arubislanderA Offline
                  arubislander @GermanAizek
                  last edited by

                  @GermanAizek said in How to detect Ubuntu Touch using system variables in shell script?:

                  no one knows when will add ability in ubuntu touch to change user name during fresh installation.

                  You are right, no one knows. But it has been this way for the past 5+ years at least.
                  I doubt any such change will happen anytime soon. In any case it is not now very high on the list of priorities.

                  πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                  Happily running Ubuntu Touch
                  Google Pixel 3a (20.04 DEV)
                  JingPad (24.04 preview)
                  Meizu Pro 5 (16.04 DEV)

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    mschmids @GermanAizek
                    last edited by

                    @GermanAizek while the title specifies 'using system variables', the text does not explicitly mention. Hence I dare to suggest, if alternatively it might be an option, to e.g. check for a certain directory/file existence, or read/write access. Any suggestions, what might be distinctive and permanent for touch vs. desktop?

                    GermanAizekG 1 Reply Last reply Reply Quote 0
                    • GermanAizekG Offline
                      GermanAizek @mschmids
                      last edited by

                      @mschmids said in How to detect Ubuntu Touch using system variables in shell script?:

                      e.g. check for a certain directory/file existence, or read/write access.

                      indeed, I can still check write/read permissions for Ubuntu Touch /image, but this is not ideal. As a developer, I made image not temporary, write persistent.

                      Xiaomi Redmi Note 7.... And more...
                      I have too many devices...

                      1 Reply Last reply Reply Quote 0
                      • CiberSheepC CiberSheep moved this topic from 20.04 Focal Fossa on
                      • First post
                        Last post