This repository contains the bicycleinit.sh script, which is used
for managing and configuring a bicycledata box. The script performs
the following tasks:
- Update the script: Checks for updates to the repository and applies them.
- Device registration: Registers the device with a server if it hasn't been registered before.
- Configuration update: Retrieves and updates the configuration
file (
config.json) based on the device's registration information.
Before using the script, ensure that the following dependencies are installed on your Raspberry Pi:
- Git: For fetching and pulling updates from the repository.
- jq: A lightweight command-line JSON processor for parsing JSON responses from the server.
- curl: For sending HTTP requests to the REST API.
You can install these dependencies using the following commands:
sudo apt-get update
sudo apt-get install git jq curlPrior to running bicycleinit.sh, make sure you clone this repository
and run the script from within the cloned directory. The script
assumes that it is located inside a Git repository with the origin
remote set to
https://github.com/bicycledata/bicycleinit.git.
The bicycleinit.sh script accepts two optional arguments:
- Branch name: The Git branch to check for updates. Defaults to
'main'. - Server REST API URL: The base URL for the server's REST API.
Defaults to
'https://bicycledata.vti.se/api'.
To run the script with default parameters, use:
./bicycleinit.shTo specify a different branch or API URL, you can pass them as arguments:
./bicycleinit.sh [branch_name] [server_rest_api_url]./bicycleinit.sh develop 127.0.0.1:5000This command will check for updates on the develop branch and use
the specified REST API URL.
This project is licensed under the MIT License - see the LICENSE file for details.