Creating an Update Daemon for SUSI Smart Speaker
A daemon in reference of operating systems is a computer program that runs as a background process rather than under direct control of the user. Various daemons are being used in SUSI smart speaker.
The following daemons have been created
- Update Daemon
- Media Discovery Daemon
- Factory Reset Daemon
In this blog, we’ll be discussing the implementation of the Update Daemon in SUSI.AI
Due to the ever-growing coding community, it is needed to provide regular updates to the smart speaker and keep it in sync with the latest technology. Hence an Update Daemon was required that could fetch updates at a regular interval.
The Updated Daemon was implemented in the following steps
1.Deciding the Update Interval
How frequently should we check for updates was the first question that was tackled while implementing this daemon.
We decided that we should check for Update, every time the Raspberry Pi starts and an internet connection was available.
2. Implementing The Decision
To start the Update script every time the Raspberry Pi starts, we decided to create Systemd rules.
Description=Update Check- SUSI Linux
The above rule waits for a network connection to be established with the Raspberry Pi and then triggers a bash script that fetches updates
3. Fetching The Updates
Now, a bash script was prepared that would fetch the latest changes from the online repo and merge the latest changes in the local repo
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse “$UPSTREAM”)
BASE=$(git merge-base @ “$UPSTREAM”)
if [ $LOCAL = $REMOTE ]
elif [ $LOCAL = $BASE ]
echo “Need to pull”
if [$CHECK = “Need-to-pull”]
git fetch UPSTREAM
git merge UPSTREAM/master
susi.ai, gsoc, gsoc’18, fossasia, update, daemon, update_daemon, smart speaker, systemd, hardware