• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
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.
    • G Offline
      GermanAizek
      last edited by 21 Feb 2024, 10:22

      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...

      L M 2 Replies Last reply 21 Feb 2024, 11:00 Reply Quote 0
      • L Online
        lduboeuf @GermanAizek
        last edited by 21 Feb 2024, 11:00

        @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

        G 1 Reply Last reply 21 Feb 2024, 11:08 Reply Quote 0
        • G Offline
          GermanAizek @lduboeuf
          last edited by GermanAizek 21 Feb 2024, 11:08

          @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...

          A 1 Reply Last reply 21 Feb 2024, 11:23 Reply Quote 0
          • A Offline
            alan_g @GermanAizek
            last edited by 21 Feb 2024, 11:23

            @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"?

            G 1 Reply Last reply 21 Feb 2024, 15:42 Reply Quote 1
            • G Offline
              GermanAizek @alan_g
              last edited by 21 Feb 2024, 15:42

              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...

              A 1 Reply Last reply 21 Feb 2024, 16:30 Reply Quote 0
              • A Offline
                arubislander @GermanAizek
                last edited by 21 Feb 2024, 16:30

                @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 21 Feb 2024, 17:02

                  @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?

                  G 1 Reply Last reply 22 Feb 2024, 12:33 Reply Quote 0
                  • G Offline
                    GermanAizek @mschmids
                    last edited by 22 Feb 2024, 12:33

                    @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
                    • C CiberSheep moved this topic from 20.04 Focal Fossa on 23 Feb 2024, 20:55
                    2 out of 8
                    • First post
                      2/8
                      Last post