mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
installer splitup and laptop alsa stuff
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PROFILE="pi"
|
||||
BINARY_SRC=""
|
||||
CONFIG_SRC=""
|
||||
|
||||
usage() {
|
||||
cat <<'USAGE'
|
||||
Usage: sudo ./pi/install_roverd.sh [options]
|
||||
|
||||
Options:
|
||||
--profile <name> Install profile: pi or debian-laptop (default: pi)
|
||||
--debian-laptop Shortcut for --profile debian-laptop
|
||||
-b, --binary <path> Path to the roverd binary (default depends on profile)
|
||||
-c, --config <path> Source config to install if /etc/roverd.yaml is missing
|
||||
(default depends on profile)
|
||||
-h, --help Show this help text
|
||||
|
||||
The script must run from the repository root and as root (sudo). It will:
|
||||
* create system users/groups if needed
|
||||
* install /usr/local/bin/roverd and /etc/roverd.yaml
|
||||
* install profile-specific video helpers and shared audio helpers
|
||||
* install profile-specific ALSA/system audio setup
|
||||
* install the fixed-command self-update helper used by admin-triggered updates
|
||||
* enable roverd.service and media publisher/listener services
|
||||
USAGE
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--profile)
|
||||
PROFILE="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--debian-laptop)
|
||||
PROFILE="debian-laptop"
|
||||
shift
|
||||
;;
|
||||
-b|--binary)
|
||||
BINARY_SRC="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-c|--config)
|
||||
CONFIG_SRC="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
select_profile() {
|
||||
case "$PROFILE" in
|
||||
pi)
|
||||
BINARY_SRC="${BINARY_SRC:-dist/roverd}"
|
||||
CONFIG_SRC="${CONFIG_SRC:-pi/roverd/roverd.sample.yaml}"
|
||||
VIDEO_HELPER_SRC="pi/bin/video-publisher.sh"
|
||||
VIDEO_HELPER_DEST="/usr/local/bin/video-publisher"
|
||||
VIDEO_SERVICE_SRC="pi/systemd/video-publisher.service"
|
||||
VIDEO_SERVICE_NAME="video-publisher.service"
|
||||
ROVERD_GROUPS="dialout,gpio,video,render,audio"
|
||||
;;
|
||||
debian-laptop)
|
||||
BINARY_SRC="${BINARY_SRC:-dist/roverd-debian-laptop}"
|
||||
CONFIG_SRC="${CONFIG_SRC:-pi/roverd/roverd.debian-laptop.sample.yaml}"
|
||||
VIDEO_HELPER_SRC="pi/bin/debian-laptop-video-publisher.sh"
|
||||
VIDEO_HELPER_DEST="/usr/local/bin/debian-laptop-video-publisher"
|
||||
VIDEO_SERVICE_SRC="pi/systemd/debian-laptop-video-publisher.service"
|
||||
VIDEO_SERVICE_NAME="debian-laptop-video-publisher.service"
|
||||
ROVERD_GROUPS="dialout,video,render,audio"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown profile: $PROFILE" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_selected_profile() {
|
||||
case "$PROFILE" in
|
||||
pi)
|
||||
# The Pi profile owns the board-specific camera, PWM, and AIY audio
|
||||
# setup. Keeping that hardware work behind this dispatcher prevents
|
||||
# the laptop profile from accidentally inheriting Pi overlays or
|
||||
# card-index assumptions.
|
||||
install_pi_profile
|
||||
;;
|
||||
debian-laptop)
|
||||
# The Debian laptop profile only installs ordinary Debian packages
|
||||
# and a laptop ALSA routing file. Anything that depends on Pi GPIO,
|
||||
# overlays, or the Google Voice HAT stays out of this path.
|
||||
install_debian_laptop_profile
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user