-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
echo "This will attempt to install Companion Satellite as a system service on this device." | ||
echo "It is designed to be run on headless servers, but can be used on desktop machines if you are happy to not have the tray icon." | ||
echo "A user called 'satellite' will be created to run the service, and various scripts will be installed to manage the service" | ||
|
||
if [ $(/usr/bin/id -u) -ne 0 ]; then | ||
echo "Must be run as root" | ||
exit 1 | ||
fi | ||
|
||
SATELLITE_BRANCH="${SATELLITE_BRANCH:-master}" | ||
|
||
# add a system user | ||
adduser --disabled-password satellite --gecos "" | ||
|
||
# install some dependencies | ||
apt-get update | ||
apt-get install -y git unzip curl libusb-1.0-0-dev libudev-dev cmake | ||
apt-get clean | ||
|
||
# install fnm to manage node version | ||
# we do this to /opt/fnm, so that the satellite user can use the same installation | ||
export FNM_DIR=/opt/fnm | ||
echo "export FNM_DIR=/opt/fnm" >> /root/.bashrc | ||
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir /opt/fnm | ||
export PATH=/opt/fnm:$PATH | ||
eval "`fnm env --shell bash`" | ||
|
||
# configure git for future updates | ||
git config --global pull.rebase false | ||
|
||
# run the update script | ||
./pi-image/update.sh $SATELLITE_BRANCH | ||
|
||
# enable start on boot | ||
systemctl enable satellite | ||
|
||
# copy config file into place | ||
cp ./pi-image/satellite-config /boot/satellite-config | ||
|
||
# add the fnm node to this users path | ||
# TODO - verify permissions | ||
echo "export PATH=/opt/fnm/aliases/default/bin:\$PATH" >> /home/satellite/.bashrc | ||
|
||
echo "Companion Satellite is installed!" | ||
echo "You can start it with \"sudo systemctl start satellite\" or \"sudo satellite-update\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters