From f0a06cb8240a2d1d5e500c3ad580006d304d7506 Mon Sep 17 00:00:00 2001 From: spoelstraethan <56567427+spoelstraethan@users.noreply.github.com> Date: Fri, 1 Dec 2023 20:07:55 -0600 Subject: [PATCH 1/4] Eliminate some errors on bookworm --- scripts/install.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index ffcb24d..60822f9 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,7 +8,8 @@ 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" @@ -16,8 +17,17 @@ 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 +### This method of installing is deprecated according to the warning messages that show up +##curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - +##sudo apt install -y nodejs +sudo apt-get update +sudo apt-get install -y ca-certificates curl gnupg +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +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 ---" @@ -52,6 +62,8 @@ sudo cp ./conf/bluetooth.service /lib/systemd/system/bluetooth.service # Replace the placeholder for the bluetooth daemon path with the correct path sudo sed -i "s|BLUETOOTH_DAEMON_PATH|${bluetoothd_path}|" /lib/systemd/system/bluetooth.service +echo "Replace legacy pi user with current user" +sed -i'' -e "s%/pi/%/$USER/%g"./conf/rpi-kvm.service echo "Copy RPI-KVM service config" sudo cp ./conf/rpi-kvm.service /lib/systemd/system/rpi-kvm.service sudo systemctl daemon-reload From 5ac9e3284e441c0a37da38f1d911322322272f81 Mon Sep 17 00:00:00 2001 From: spoelstraethan <56567427+spoelstraethan@users.noreply.github.com> Date: Fri, 1 Dec 2023 20:45:06 -0600 Subject: [PATCH 2/4] Fix sed error and enable re-running script without interactive prompts for testing --- scripts/install.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 60822f9..7c8f498 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -12,10 +12,28 @@ 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 +### This is naughty according to Python, better to install the packages via python3-* to be managed by the system, otherwise need a virtualenv +#Install required python packages via pip3 +# error: externally-managed-environment + +# × This environment is externally managed +# ╰─> To install Python packages system-wide, try apt install +# python3-xyz, where xyz is the package you are trying to +# install. + +# If you wish to install a non-Debian-packaged Python package, +# create a virtual environment using python3 -m venv path/to/venv. +# Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make +# sure you have python3-full installed. + +# For more information visit http://rptl.io/venv + +# note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. +# hint: See PEP 668 for the detailed specification. +#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 +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 dev tools" ### This method of installing is deprecated according to the warning messages that show up ##curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - @@ -23,7 +41,9 @@ echo "Install dev tools" sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +# --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 @@ -63,7 +83,7 @@ sudo cp ./conf/bluetooth.service /lib/systemd/system/bluetooth.service sudo sed -i "s|BLUETOOTH_DAEMON_PATH|${bluetoothd_path}|" /lib/systemd/system/bluetooth.service echo "Replace legacy pi user with current user" -sed -i'' -e "s%/pi/%/$USER/%g"./conf/rpi-kvm.service +sed -i'' -e "s|/pi/|/${SUDO_USER}/|g" ./conf/rpi-kvm.service echo "Copy RPI-KVM service config" sudo cp ./conf/rpi-kvm.service /lib/systemd/system/rpi-kvm.service sudo systemctl daemon-reload From 6c934741cc06282ec2e9dd561aa3bbe66b32b5ce Mon Sep 17 00:00:00 2001 From: spoelstraethan <56567427+spoelstraethan@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:01:31 -0600 Subject: [PATCH 3/4] Reorder sed execution to keep good version in git --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7c8f498..6e5287b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -82,10 +82,10 @@ sudo cp ./conf/bluetooth.service /lib/systemd/system/bluetooth.service # Replace the placeholder for the bluetooth daemon path with the correct path sudo sed -i "s|BLUETOOTH_DAEMON_PATH|${bluetoothd_path}|" /lib/systemd/system/bluetooth.service -echo "Replace legacy pi user with current user" -sed -i'' -e "s|/pi/|/${SUDO_USER}/|g" ./conf/rpi-kvm.service 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 From 1f439d06105268a98dbc9ac0c475910d7082de80 Mon Sep 17 00:00:00 2001 From: Maximilian Bauer Date: Sat, 2 Dec 2023 07:45:55 +0100 Subject: [PATCH 4/4] Update install.sh --- scripts/install.sh | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 6e5287b..509f996 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -12,32 +12,9 @@ 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 -### This is naughty according to Python, better to install the packages via python3-* to be managed by the system, otherwise need a virtualenv -#Install required python packages via pip3 -# error: externally-managed-environment - -# × This environment is externally managed -# ╰─> To install Python packages system-wide, try apt install -# python3-xyz, where xyz is the package you are trying to -# install. - -# If you wish to install a non-Debian-packaged Python package, -# create a virtual environment using python3 -m venv path/to/venv. -# Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make -# sure you have python3-full installed. - -# For more information visit http://rptl.io/venv - -# note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. -# hint: See PEP 668 for the detailed specification. -#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-dbus-next python3-aiohttp python3-rpi.gpio python3-numpy python3-gi -y -echo "Install dev tools" -### This method of installing is deprecated according to the warning messages that show up -##curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - -##sudo apt install -y nodejs +echo "Install nodejs" sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings