{"id":29099948,"url":"https://github.com/bcc-code/casync-updater","last_synced_at":"2025-06-28T17:38:17.312Z","repository":{"id":58776395,"uuid":"526861722","full_name":"bcc-code/casync-updater","owner":"bcc-code","description":"[BCC SA] casync based OTA updater for software running on linux","archived":false,"fork":false,"pushed_at":"2023-05-15T15:00:38.000Z","size":133,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"beta","last_synced_at":"2024-04-14T02:53:08.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcc-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-20T07:52:24.000Z","updated_at":"2023-01-20T19:45:27.000Z","dependencies_parsed_at":"2023-01-19T23:21:48.326Z","dependency_job_id":null,"html_url":"https://github.com/bcc-code/casync-updater","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcc-code/casync-updater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fcasync-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fcasync-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fcasync-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fcasync-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcc-code","download_url":"https://codeload.github.com/bcc-code/casync-updater/tar.gz/refs/heads/beta","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcc-code%2Fcasync-updater/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262471116,"owners_count":23316617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-28T17:37:55.289Z","updated_at":"2025-06-28T17:38:17.305Z","avatar_url":"https://github.com/bcc-code.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Deployment](https://github.com/bcc-code/casync-updater/actions/workflows/master.yml/badge.svg)](https://github.com/bcc-code/casync-updater/actions/workflows/master.yml)\n# casync-updater\ncasync based OTA updater for software running on linux\n\n## Introduction\nA simple self updating software update system with offline updating capabilities through locally attached storage (e.g. a USB drive). More information on casync can be found on by running ```man casync```.\n\n![Overview](doc/img/overview.png)\n\n## Dependencies\n* casync\n* diffutils\n* nodejs\n\n## Installation\n```shell\nsudo apt-get update\nsudo apt-get upgrade\nwget -q https://github.com/bcc-code/casync-updater/raw/master/deploy/install.sh -O - | sudo bash\n```\n*Installation script only tested successfully on Raspberry Pi OS Buster \u0026 Ubuntu 20.04. It is not working on Ubuntu 18.04.*\n\nThe casync-updater client is installed as a systemd service.\nPlease run ```systemctl status casync-updater.service``` to ensure the service is running correctly.\n\nClient configuration files directory: /etc/casync-updater\n\nNode JS scripts directory: /opt/casync-updater\n\nRestart the casync-updater service after modifying configuration files for the changes to take effect.\n\n## Server\nThe server.js Node.js script should executed passing the configuration file as an argument:\n```console\nnode /opt/casync-updater/server.js your/directory/server.json\n```\nThis can be included as part of your CI/CD pipeline.\n\nConfiguration file example:\n```json\n{\n    \"index\": \"/var/www/html/index.caidx\",\n    \"store\": \"/var/www/html/store.castr\",\n    \"source\": \"/your/directory/source\"\n}\n```\nConfiguration can also be passed as an array:\n```json\n[\n    {\n        \"index\": \"/var/www/html/index.caidx\",\n        \"store\": \"/var/www/html/store.castr\",\n        \"source\": \"/your/directory/source\"\n    },\n    {\n        \"index\": \"/var/www/html/index2.caidx\",\n        \"store\": \"/var/www/html/store2.castr\",\n        \"source\": \"/your/directory/source2\"\n    }\n]\n```\n\nwhere:\n* \"index\" is the path to the casync index file (typically stored in a web root directory).\n* \"store\" is the path to the casync store directory (typically stored in a web root directory).\n* \"source\" is the path to the directory or device where the repository to be distributed is stored.\n\n## Client\nThe casync-updater client reads a configuration file / directory with configuration files on startup. When installed using the installation script as described above, it will read all JSON formatted text configuration files in the /etc/casync-updater directory.\nA configuration file may contain one or several configuration entries.\n\nThe installation script includes a default configuration script used to automatically update the casync-updater installation. This default configuration file may be modified to suit your needs (e.g. to point the updater to your own source location etc.)\n\nConfiguration file example:\n```json\n[\n    {\n        \"interval\": 3600000,\n        \"srcIndex\": \"https://project1.example/updates/fancyName.caidx\",\n        \"srcStore\": \"https://project1.example/updates/fancyName.castr\",\n        \"dstPath\": \"/usr/bin/project1\"\n    },\n    {\n        \"interval\": 1800000,\n        \"srcIndex\": \"https://myproject.example/updates/fancyName.caidx\",\n        \"srcStore\": \"https://myproject.example/updates/fancyName.castr\",\n        \"backupIndex\": \"/media/backupDrive/myproject-updater/otherFancyName.caidx\",\n        \"backupStore\": \"/media/backupDrive/myproject-updater/otherFancyName.castr\",\n        \"dstPath\": \"/usr/bin/myproject\",\n        \"triggers\": [\n            {\n                \"paths\": [\n                    \"path/to/file1\",\n                    \".\",\n                    \"path/to/dir2\"\n                ],\n                \"actions\": [\n                    \"sh /action/script/location.sh\",\n                    \"systemctl restart your.service\"\n                ]\n            },\n            {\n                \"paths\": [\n                    \"another/path\"\n                ],\n                \"actions\": [\n                    \"node yourscript.js\"\n                ]\n            }\n        ],\n        \"startup\": [\n            \"first/command\",\n            \"second/command\"\n        ]\n    }\n]\n```\nwhere:\n* \"interval\" is the update interval in milliseconds\n* \"srcIndex\" is the location of the (online) source casync (caidx) index file\n* \"srcStore\" is the location if the (online) source casync (castr) store directory\n* \"backupIndex\" (optional) is the path to the local backup casync index file (typically a location on external storage used for transferring updates to offline devices).\n* \"backupStore\" (required only when backupIndex is set) is the path to the local backup casync store directory.\n* \"dstPath\" is the local directory path to be updated\n* \"triggers\" is a list of paths and associated actions. When one of the specified \"paths\" (relative directory or file path) is updated, the list of \"actions\" is executed (shell commands).\n* \"startup\" is a list of commands that are executed on service startup. The startup commands are executed after the initial casync extract is complete and corresponding triggers are executed. If the exact same action / command was triggered during the cycle, the given action will not be run by the startup trigger.\n\n## Improving performance\nThe casync-updater client (```client.js```) checks the source casync archive checksum, and compares it to the destination location's checksum before extracting the changes. Digesting the checksum is however not efficient (network usage wise). The casync-updater server (```server.js```) therefore creates a ```.cks``` file containing the latest checksum. The client tries to download the checksum file, and if it exists uses that checksum to compare to the destination location's checksum. If the checksum file is not found in the source location, it will do a full digest to calculate the source checksum.\n\ncasync mtree output is also handled in a similar way (used to detect changes for triggers). The mtree output is saved to a ```.mtree``` file when creating an casync archive.\n\n## To do\n- [ ] Secure backup store - prevent unintentional / malicious tampering with offline updates. (Ideas welcome)\n- [ ] Prevent client.js from terminating while busy executing a cycle.\n- [ ] Add online check - check for updates on online detection (ping check to update server?)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcc-code%2Fcasync-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcc-code%2Fcasync-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcc-code%2Fcasync-updater/lists"}