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 curl
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.ochel.se:80'
.
To run the script with default parameters, use:
./bicycleinit.sh
To 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:5000
This 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.