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

    Contacts CardDav - automatic setup and sync through this script

    Scheduled Pinned Locked Moved General
    18 Posts 6 Posters 1.8k Views 3 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.
      • T Offline
        tonton_
        last edited by tonton_

        Hi all UT users, here is a Carddav script to sync your contacts easily.
        You'll need your Carddav URL, username and password, and that's it !

        The script has to be runned (so chmod +x script_file to make it executable), through adb or through your phone.

        It let you choose to install a manual sync icon, and to setup an automatic sync through systemd.

        It will also let you delete a sync quickly, and get rid of its manual sync icon and autosync systemd files. You just have to remember your carddav config name, and type it !

        Here is a little video i made to demo it
        https://diode.zone/w/89PaXUEKTT443wSDtAQX9t

        And you can download it here !

        The github :
        https://github.com/samytichadou/ubuntutouch_carddav_sync_script

        Only tested on my FP4 with UT focal for now ! Don't hesitate to report any issues or if everything went smooth here

        Hope it can fill the gap while waiting for a proper UT implementation 🙂

        This script is based on this one by Bastos77 and Vanyasem, thanks a lot to them !

        PS : I don't have the skills/time to make it a proper UT app, but if anyone out here is interested to do it, don't hesitate to ping me !

        Cheers

        L 1 Reply Last reply Reply Quote 4
        • P Offline
          Pingu
          last edited by

          Cool thing 😎

          UT since 2012 (also Sailfish)

          1 Reply Last reply Reply Quote 1
          • T tonton_ referenced this topic on
          • N Offline
            noahtehomas
            last edited by

            It's a great script but I think it would be helpful to add a step-by-step guide for beginners on how to run it via adb or directly on the phone.

            T 2 Replies Last reply Reply Quote 1
            • T Offline
              tonton_ @noahtehomas
              last edited by

              @noahtehomas
              Thanks for the input, i'll add it to the github readme when i have some spare time!

              1 Reply Last reply Reply Quote 1
              • T Offline
                tonton_ @noahtehomas
                last edited by

                @noahtehomas
                Just updated the github, for info here is the git readme :

                A simple bash script to setup your carddav contact.

                The script also have the ability to setup an auto synchronisation (hourly, daily, weekly...) and to add a sync button in your launcher.

                You can use this script two ways : locally on and from your phone, or through adb (android debug tool) on your computer through a terminal.

                • First you have to put the script file on your phone storage.

                  You can do it by *connecting your phone to a computer and using the file explorer.

                  You can also use adb : with your phone connected to your computer (with usb debugging activated), you can use this command : adb push filepath_on_your_system destination_filepath_on_phone

                • Then you have to make your file executable and launch it.

                  • If you are doing this through adb, first connect to your phone shell with this command adb shell, if you are doing this locally, ignore this last command.
                  • Go into the folder you copied the script cd script_folder
                  • Make it executable chmod -x ./scriptfile.
                  • You can now run the script and follow its instructions ./scriptfile
                N 1 Reply Last reply Reply Quote 2
                • N Offline
                  noahtehomas @tonton_
                  last edited by

                  @tonton_ said in Contacts CardDav - automatic setup and sync through this script:

                  Just updated the github, for info here is the git readme :

                  A simple bash script to setup your carddav contact.

                  The script also have the ability to setup an auto synchronisation (hourly, daily, weekly...) and to add a sync button in your launcher.

                  You can use this script two ways : locally on and from your phone, or through adb (android debug tool) on your computer through a terminal.

                  First you have to put the script file on your phone storage.

                  You can do it by *connecting your phone to a computer and using the file explorer.

                  You can also use adb : with your phone connected to your computer (with usb debugging activated), you can use this command : adb push filepath_on_your_system destination_filepath_on_phone

                  Then you have to make your file executable and launch it.

                  If you are doing this through adb, first connect to your phone shell with this command adb shell, if you are doing this locally, ignore this last command.
                  Go into the folder you copied the script cd script_folder
                  Make it executable chmod -x ./scriptfile.
                  You can now run the script and follow its instructions ./scriptfile

                  Yeah checked the tutorial, it's a complete guide for a beginner group. Again, thanks for the guide.

                  1 Reply Last reply Reply Quote 1
                  • R Offline
                    Rustic
                    last edited by Rustic

                    Hello,
                    Thanks so much for this script.
                    I have a self-hosted radicale service to host my contacts and calendar.
                    I run your script and it failed.
                    I use this service in android with Davx5 app and works fine.
                    How can I make it work in ubuntu-touch?

                    T 1 Reply Last reply Reply Quote 1
                    • T Offline
                      tonton_ @Rustic
                      last edited by

                      @Rustic did not try with radicale, is it a nextcloud/owncloud variant ?
                      where did the script failed exactly ?
                      do you have the console return ?

                      R 1 Reply Last reply Reply Quote 0
                      • R Offline
                        Rustic @tonton_
                        last edited by

                        @tonton_ I tried again, this time on my Lenovo Tab M10 HD, and it worked fine.
                        Before I tried on a RedMi Note 9 Pro and it didn't work but I cant get the console return because I went back to LineageOs 21 and on 2n mobile I have PostmarketOs gnome-mobile.
                        It would be nice to have the calendar synced as well.
                        Thanks so much.

                        T 1 Reply Last reply Reply Quote 1
                        • T Offline
                          tonton_ @Rustic
                          last edited by

                          @Rustic
                          nice that it worked at least, don't hesitate to report the command output if it fails again 🙂
                          and concerning the calendar, i didn't implement it because it works out of the box (for me at least) with UT account system

                          R 1 Reply Last reply Reply Quote 0
                          • R Offline
                            Rustic @tonton_
                            last edited by

                            @tonton_ Adding radicale calendar does not work. The calendar is being added but it does not sync.
                            If at least it would be possible to import a .ics from within the calendar app that would be also nice.

                            T 1 Reply Last reply Reply Quote 0
                            • T Offline
                              tonton_ @Rustic
                              last edited by tonton_

                              @Rustic don't have a lot of time for now, but you could try to use this script :
                              https://gist.github.com/vanyasem/379095d25ac350676fc70c42efe17c8c
                              after removing all contact related lines, and cron related (no more cron on focal)

                              If this works for you tell me, i could try to include it in the script (with the auto sync and sync button features) no garanty i'll have time though, sorry !

                              if you make it work, something like this should launch the sync :

                              syncevolution --sync two-way $CONTACTS_CONFIG_NAME
                              

                              with $CONTACTS_CONFIG_NAME being the input you set in the script
                              tell me if it works for you !

                              Oh and radicale calendar, if caldav, should work natively, so you can also fill a bugreport for this if you have time 🙂

                              R 1 Reply Last reply Reply Quote 1
                              • R Offline
                                Rustic @tonton_
                                last edited by Rustic

                                @tonton_ It worked. This is the command output:

                                Synchronization successful.

                                Changes applied during synchronization (@radicale):
                                +------------------|-----------------------|-----------------------|-CON-+
                                | | @radicale | @default | FLI |
                                | Source | NEW | MOD | DEL | ERR | NEW | MOD | DEL | ERR | CTS |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                                | personalcalendar | 0 | 0 | 0 | 0 | 79 | 0 | 0 | 0 | 0 |
                                | refresh-from-local, 54 KB sent by client, 0 KB received |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                                | start Wed Jun 5 19:39:48 2024, duration 0:10min |
                                | synchronization completed successfully |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                                [INFO] creating complete data backup after sync (enabled with dumpData and needed for printChanges)

                                Synchronization successful.

                                Changes applied during synchronization:
                                +------------------|-----------------------|-----------------------|-CON-+
                                | | @default | @radicale | FLI |
                                | Source | NEW | MOD | DEL | ERR | NEW | MOD | DEL | ERR | CTS |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                                | personalcalendar | 79 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
                                | refresh-from-remote, 0 KB sent by client, 54 KB received |
                                | item(s) in database backup: 0 before sync, 79 after it |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                                | start Wed Jun 5 19:39:46 2024, duration 0:13min |
                                | synchronization completed successfully |
                                +------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+

                                Data modified @default during synchronization:
                                *** @default/personalcalendar ***
                                Comparison was impossible.

                                1 Reply Last reply Reply Quote 0
                                • R Offline
                                  Rustic
                                  last edited by

                                  I guess in order to sync this cal I'll have to erase .cache/syncevolution and then run the script again.
                                  At least it worked.
                                  Thanks so much.

                                  T 1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tonton_ @Rustic
                                    last edited by tonton_

                                    @Rustic
                                    no you should just be able to run this command (didn't test it though) :

                                    syncevolution --sync two-way $CONTACTS_CONFIG_NAME
                                    

                                    replace the $CONTACTS_CONFIG_NAME by the name you gave to your db, try it, if it works you can put this command in a desktop file (to have an icon to sync manually in your ut launcher) or a systemd timer to auto sync ! (you can take a look at what does my script for these)
                                    line 131 to 140 for the desktop file and line 148 to 183 for the systemd timer/service files 🙂

                                    1 Reply Last reply Reply Quote 0
                                    • L Offline
                                      lsitongia @tonton_
                                      last edited by

                                      @tonton_ Thank you for this work.

                                      LINMOB says that there are improvements to CardDAV. I wonder if they are referring to your work here?

                                      https://linmob.net/weekly-update-23-2024/

                                      T 1 Reply Last reply Reply Quote 1
                                      • T Offline
                                        tonton_ @lsitongia
                                        last edited by

                                        I dont think so, my script is merely a setup helper for the existing backend ! I think they are refering to lionel s work on the new contact backend ! Take a look at last ut q&a video where he showcased it, it looks awesome ! 🙂

                                        1 Reply Last reply Reply Quote 0
                                        • Z Offline
                                          zedr0k
                                          last edited by

                                          Thanks a lot for that script. It worked great for me. 👍

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