diff --git a/scripts/install.sh b/scripts/install.sh index ffcb24d..509f996 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,16 +8,23 @@ function fail { echo "### RPI-KVM Install ##############" echo "--- RPI-KVM Dependency Install ---" echo "Install required basic packages via apt-get" -sudo apt-get install git tmux python python3 python-dev python3-dev python3-pip -y +sudo apt update +sudo apt-get install git tmux python-is-python3 python3 python3-dev python3-pip -y echo "Install required bluetooth packages via apt-get" sudo apt-get install bluez bluez-tools bluez-firmware python3-bluez -y -echo "Install required python packages via pip3" -sudo pip3 install evdev dbus-next aiohttp RPi.GPIO echo "Install required python packages via apt-get" -sudo apt-get install python3-pyudev python3-evdev python3-dbus python3-numpy python3-gi -y -echo "Install dev tools" -curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - -sudo apt install -y nodejs +sudo apt-get install python3-pyudev python3-evdev python3-dbus python3-dbus-next python3-aiohttp python3-rpi.gpio python3-numpy python3-gi -y +echo "Install nodejs" +sudo apt-get update +sudo apt-get install -y ca-certificates curl gnupg +sudo mkdir -p /etc/apt/keyrings +# --yes allows overwriting if re-running the script (to repair a broken install or get new fixes) +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/nodesource.gpg +# This can be changed to a newer supported version once tested +NODE_MAJOR=16 +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list +sudo apt-get update +sudo apt-get install nodejs -y echo "--- Dependency Install Done ------" echo "--- RPI-KVM Configuration Step ---" @@ -54,6 +61,8 @@ sudo sed -i "s|BLUETOOTH_DAEMON_PATH|${bluetoothd_path}|" /lib/systemd/system/bl echo "Copy RPI-KVM service config" sudo cp ./conf/rpi-kvm.service /lib/systemd/system/rpi-kvm.service +echo "Replace legacy pi user with current user if necessary" +sudo sed -i'' -e "s|/pi/|/${SUDO_USER}/|g" /lib/systemd/system/rpi-kvm.service sudo systemctl daemon-reload echo "Restart bluetooth service with the new config" sudo systemctl restart bluetooth