Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jan 18, 2025
1 parent 64060fa commit 24532cf
Showing 1 changed file with 33 additions and 71 deletions.
104 changes: 33 additions & 71 deletions build_raspOVOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,49 +94,19 @@ echo "The UID for '$USER' is: $TUID"
# Update package list and install necessary tools
echo "Updating base system..."
apt-get update
apt-get install -y --no-install-recommends jq git unzip curl build-essential fake-hwclock userconf-pi swig python3-dev python3-pip fbi libasound2-dev mosh dirmngr
apt-get install -y --no-install-recommends jq git unzip curl build-essential fake-hwclock userconf-pi swig python3-dev python3-pip fbi libasound2-dev mosh mpv libssl-dev libfann-dev portaudio19-dev libpulse-dev i2c-tools pulseaudio-utils dirmngr python3-libcamera python3-kms++ libcap-dev pipewire pipewire-alsa alsa-utils kdeconnect upmpdcli mpd systemd-zram-generator
# what else can be removed to make the system even lighter?
apt purge -y cups ppp

echo "Enabling ssh..."
ln -s /etc/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/

echo "Copying raspOVOS overlay..."
sudo cp -rv /mounted-github-repo/overlays/base /
# ensure permissions etc
sudo chmod +x /usr/libexec/ovos*
sudo chmod +x /usr/local/bin/ovos*

echo "Setting up libcamera..."
apt install -y python3-libcamera python3-kms++ libcap-dev

echo "Installing uv and sdnotify..."
pip install sdnotify uv --break-system-packages

echo "Installing Pipewire..."
apt install -y pipewire pipewire-alsa alsa-utils
SOUND_SERVER="pipewire"
chmod 644 /home/$USER/.asoundrc
add_user_to_group $USER audio
add_user_to_group $USER pipewire
# Add user to rtkit group if it exists
if getent group rtkit > /dev/null 2>&1; then
add_user_to_group $USER rtkit
fi

echo "Installing KDEConnect..."
apt-get install -y --no-install-recommends kdeconnect
chmod 644 /etc/systemd/system/kdeconnect.service
ln -s /etc/systemd/system/kdeconnect.service /etc/systemd/system/multi-user.target.wants/kdeconnect.service

echo "Installing upmpdcli for DLNA playback"
apt-get install -y --no-install-recommends upmpdcli mpd
ln -s /usr/lib/systemd/system/mpd.service /etc/systemd/system/multi-user.target.wants/mpd.service

echo "Setting up ZRAM..."
apt-get install -y --no-install-recommends systemd-zram-generator
ln -s /usr/lib/systemd/system/[email protected] /etc/systemd/system/multi-user.target.wants/[email protected]

echo "Tuning /etc/fstab..."
bash /mounted-github-repo/scripts/setup_fstab.sh

Expand All @@ -146,41 +116,8 @@ grep -q "quiet fastboot" /boot/firmware/cmdline.txt || sed -i 's/$/ quiet fastbo
# support for mk1
sed -i 's/console=serial0,115200//g' /boot/firmware/cmdline.txt

# Update package list and install necessary tools
echo "Installing system packages..."
apt-get install -y --no-install-recommends mpv libssl-dev libfann-dev portaudio19-dev libpulse-dev

# splashscreen
echo "Enabling OVOS splashscreen..."
chmod 644 /etc/systemd/system/splashscreen.service
ln -s /etc/systemd/system/splashscreen.service /etc/systemd/system/multi-user.target.wants/splashscreen.service

# setup ovos-i2csound
echo "Enabling ovos-i2csound..."
apt-get install -y --no-install-recommends i2c-tools
chmod 644 /etc/systemd/system/i2csound.service
chmod +x /usr/libexec/ovos-i2csound
ln -s /etc/systemd/system/i2csound.service /etc/systemd/system/multi-user.target.wants/i2csound.service

echo "Enabling raspovos-audio-setup..."
apt-get install -y --no-install-recommends pulseaudio-utils
ln -s /etc/systemd/system/autoconfigure_soundcard.service /etc/systemd/system/multi-user.target.wants/autoconfigure_soundcard.service

echo "Installing admin phal..."
pip install sdnotify ovos-bus-client ovos-phal ovos-PHAL-plugin-system -c $CONSTRAINTS --break-system-packages
chmod 644 /etc/systemd/system/ovos-admin-phal.service
ln -s /etc/systemd/system/ovos-admin-phal.service /etc/systemd/system/multi-user.target.wants/ovos-admin-phal.service

echo "Enabling messagebus signals..."
ln -s /etc/systemd/system/ovos-reboot-signal.service /etc/systemd/system/multi-user.target.wants/ovos-reboot-signal.service
ln -s /etc/systemd/system/ovos-shutdown-signal.service /etc/systemd/system/multi-user.target.wants/ovos-shutdown-signal.service
chmod +x /usr/libexec/ovos-stop \
/usr/libexec/ovos-restart-signal \
/usr/libexec/ovos-reboot-signal \
/usr/libexec/ovos-shutdown-signal \
/usr/libexec/ovos-ocp-pause-signal \
/usr/libexec/ovos-ocp-play-signal \
/usr/libexec/ovos-ocp-stop-signal

# Create virtual environment for ovos
echo "Creating virtual environment..."
Expand Down Expand Up @@ -213,15 +150,30 @@ uv pip install --no-progress --pre ovos-media-plugin-spotify ovos-skill-spotify
echo "Installing deprecated OVOS packages for compat..."
uv pip install --no-progress --pre ovos-lingua-franca ovos-backend-client -c $CONSTRAINTS

echo "Ensuring log file permissions for ovos group..."
chown -R $TUID:$TGID /home/$USER/.local/state/mycroft
chmod -R 2775 /home/$USER/.local/state/mycroft

# Set permissions for services
chmod 644 /home/$USER/.config/systemd/user/*.service
chmod +x /usr/libexec/ovos-*
echo "Configuring audio..."
add_user_to_group $USER audio
add_user_to_group $USER pipewire
# Add user to rtkit group if it exists
if getent group rtkit > /dev/null 2>&1; then
add_user_to_group $USER rtkit
fi

echo "Enabling system services..."
# Enable services manually by creating symbolic links
chmod 644 /etc/systemd/system/kdeconnect.service
chmod 644 /etc/systemd/system/ovos-admin-phal.service
chmod 644 /etc/systemd/system/i2csound.service
chmod 644 /etc/systemd/system/splashscreen.service
ln -s /etc/systemd/system/ovos-admin-phal.service /etc/systemd/system/multi-user.target.wants/ovos-admin-phal.service
ln -s /etc/systemd/system/i2csound.service /etc/systemd/system/multi-user.target.wants/i2csound.service
ln -s /etc/systemd/system/autoconfigure_soundcard.service /etc/systemd/system/multi-user.target.wants/autoconfigure_soundcard.service
ln -s /etc/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/
ln -s /etc/systemd/system/splashscreen.service /etc/systemd/system/multi-user.target.wants/splashscreen.service
ln -s /etc/systemd/system/kdeconnect.service /etc/systemd/system/multi-user.target.wants/kdeconnect.service
ln -s /usr/lib/systemd/system/mpd.service /etc/systemd/system/multi-user.target.wants/mpd.service
ln -s /usr/lib/systemd/system/[email protected] /etc/systemd/system/multi-user.target.wants/[email protected]

chmod 644 /home/$USER/.config/systemd/user/*.service
mkdir -p /home/$USER/.config/systemd/user/default.target.wants/
ln -s /home/$USER/.config/systemd/user/ovos.service /home/$USER/.config/systemd/user/default.target.wants/ovos.service
ln -s /home/$USER/.config/systemd/user/ovos-skills.service /home/$USER/.config/systemd/user/default.target.wants/ovos-skills.service
Expand All @@ -233,9 +185,19 @@ ln -s /home/$USER/.config/systemd/user/ovos-gui.service /home/$USER/.config/syst
ln -s /home/$USER/.config/systemd/user/ovos-ggwave.service /home/$USER/.config/systemd/user/default.target.wants/ovos-ggwave.service
ln -s /home/$USER/.config/systemd/user/ovos-spotify.service /home/$USER/.config/systemd/user/default.target.wants/ovos-spotify.service

echo "Enabling messagebus signals..."
ln -s /etc/systemd/system/ovos-reboot-signal.service /etc/systemd/system/multi-user.target.wants/ovos-reboot-signal.service
ln -s /etc/systemd/system/ovos-shutdown-signal.service /etc/systemd/system/multi-user.target.wants/ovos-shutdown-signal.service

echo "Ensuring log file permissions for ovos group..."
chown -R $TUID:$TGID /home/$USER/.local/state/mycroft
chmod -R 2775 /home/$USER/.local/state/mycroft

echo "Ensuring permissions for $USER user..."
# Replace 1000:1000 with the correct UID:GID if needed
chown -R $TUID:$TGID /home/$USER
chmod +x /usr/libexec/ovos-*
chmod 644 /home/$USER/.asoundrc

# Enable lingering for the user
echo "Enabling lingering for $USER user ..."
Expand Down

0 comments on commit 24532cf

Please sign in to comment.