Upgrade to version 2 (Bullseye)

This commit is contained in:
Alexandre CATTEAU 2021-11-20 15:35:34 +01:00
parent c8b657d4d1
commit 43f7fa1b85
2 changed files with 14 additions and 24 deletions

View File

@ -1,10 +1,10 @@
# uPnP renderer # uPnP renderer
## Version 1 ## Version 2
This repository contains files used to set up our uPnP renderer on a freshly installed Armbian. Target is Buster. This repository contains files used to set up our uPnP renderer on a freshly installed Armbian. Target is Bullseye.
### Introduction ### Introduction
Version 1 implementation works roughly as follows: Version 2 implementation works roughly as follows:
* the Armbian-based device is connected to local network, and to an audio output device (usually via USB); * the Armbian-based device is connected to local network, and to an audio output device (usually via USB);
* MPD and upmpdcli are installed on the device. * MPD and upmpdcli are installed on the device.

View File

@ -20,10 +20,12 @@ init() {
install_packages() { install_packages() {
echo "Starting packages installation" echo "Starting packages installation"
curl https://www.lesbonscomptes.com/pages/jf-at-dockes.org.pgp | gpg --import -
gpg --export '7808CE96D38B9201' | apt-key add -
sed -i -e "s/$deb_apt_default_repo/$deb_apt_repo/g" /etc/apt/sources.list sed -i -e "s/$deb_apt_default_repo/$deb_apt_repo/g" /etc/apt/sources.list
echo "deb http://www.lesbonscomptes.com/upmpdcli/downloads/raspbian/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/upmpdcli.list
wget -P /usr/share/keyrings/ https://www.lesbonscomptes.com/pages/lesbonscomptes.gpg
wget -P /etc/apt/sources.list.d/ https://www.lesbonscomptes.com/upmpdcli/pages/upmpdcli-rbullseye.list
sed -i -e "s/deb-src/#deb-src/g" /etc/apt/sources.list.d/upmpdcli-rbullseye.list
apt update apt update
apt upgrade -y apt upgrade -y
apt install -y vim tree tmux neofetch mpd upmpdcli apt install -y vim tree tmux neofetch mpd upmpdcli
@ -35,11 +37,6 @@ add_users() {
chmod 700 /home/$user chmod 700 /home/$user
} }
set_sudo_conf() { # TODO that doesn't seem to work
echo "Setting sudo configuration"
sed -i -e "s/%sudo ALL=(ALL:ALL) ALL/%sudo ALL=(ALL:ALL) $sudo_no_passwd ALL/g" /etc/sudoers
}
get_conf() { get_conf() {
echo "Getting configuration" echo "Getting configuration"
sudo -H -u $user mkdir $sync_directory_path sudo -H -u $user mkdir $sync_directory_path
@ -51,21 +48,14 @@ get_conf() {
set_conf() { set_conf() {
echo "Setting configuration" echo "Setting configuration"
#sudo -H -u $user chmod uo+x $sync_directory_path/clean-cloud.sh $sync_directory_path/scan-to-cloud.sh
ln -s $sync_directory_path/*.service $systemd_units_path/ ln -s $sync_directory_path/*.service $systemd_units_path/
ln -s $sync_directory_path/*.timer $systemd_units_path/ ln -s $sync_directory_path/*.timer $systemd_units_path/
#ln -s $sync_directory_path/*.socket $systemd_units_path/ # TODO add a check here
#ln -s $sync_directory_path/*.mount $systemd_units_path/
#ln -s $sync_directory_path/*.path $systemd_units_path/
systemctl daemon-reload systemctl daemon-reload
systemctl enable conf-sync.timer mpd.service upmpdcli.service restart-upmpdcli.timer systemctl enable conf-sync.timer mpd.service upmpdcli.service restart-upmpdcli.timer
} }
set_upmpdcli_service() { set_upmpdcli_service() {
echo "Setting custom upmpdcli service unit" echo "Setting custom upmpdcli service unit"
# Old way, less clean
#cp /lib/systemd/system/upmpdcli.service $systemd_units_path/
#sed -i -e "s/upmpdcli -c \/etc\/upmpdcli.conf/upmpdcli -f %H/g" $systemd_units_path/upmpdcli.service
mkdir $systemd_units_path/upmpdcli.service.d mkdir $systemd_units_path/upmpdcli.service.d
echo "[Service]" > $systemd_units_path/upmpdcli.service.d/exec.conf echo "[Service]" > $systemd_units_path/upmpdcli.service.d/exec.conf
echo "ExecStart=" >> $systemd_units_path/upmpdcli.service.d/exec.conf echo "ExecStart=" >> $systemd_units_path/upmpdcli.service.d/exec.conf
@ -74,11 +64,11 @@ set_upmpdcli_service() {
set_alsa_conf() { set_alsa_conf() {
echo "Setting ALSA configuration" echo "Setting ALSA configuration"
echo "defaults.pcm.card $audio_device echo "defaults.pcm.card $audio_device" > $alsa_conf_file_path
defaults.ctl.card $audio_device" > $alsa_conf_file_path echo "defaults.ctl.card $audio_device" >> $alsa_conf_file_path
} }
set_cpufreq() { set_cpufreq() { # This is specifically for our Orange Pi Zero; may not be required in all cases
echo "Setting CPU frequency to performance" echo "Setting CPU frequency to performance"
sed -i -e "s/GOVERNOR=ondemand/GOVERNOR=performance/g" /etc/default/cpufrequtils sed -i -e "s/GOVERNOR=ondemand/GOVERNOR=performance/g" /etc/default/cpufrequtils
} }
@ -91,6 +81,8 @@ rcs_links() {
ln -s /home/$user/.bashrc /root/.bashrc ln -s /home/$user/.bashrc /root/.bashrc
sudo -H -u $user ln -s $sync_directory_path/vimrc /home/$user/.vimrc sudo -H -u $user ln -s $sync_directory_path/vimrc /home/$user/.vimrc
ln -s /home/$user/.vimrc /root/.vimrc ln -s /home/$user/.vimrc /root/.vimrc
sudo -H -u $user ln -s $sync_directory_path/tmux.conf /home/$user/.tmux.conf
ln -s /home/$user/.tmux.conf /root/.tmux.conf
} }
ssh_pubkey() { ssh_pubkey() {
@ -115,10 +107,9 @@ hostname='pi2'
fqdn='pi2.kto.black' fqdn='pi2.kto.black'
keymap='fr' keymap='fr'
timezone='Europe/Paris' timezone='Europe/Paris'
deb_apt_default_repo='httpredir.debian.org' deb_apt_default_repo='deb.debian.org'
deb_apt_repo='ftp.fr.debian.org' deb_apt_repo='ftp.fr.debian.org'
user='alex' user='alex'
sudo_no_passwd="NOPASSWD:"
sync_directory_path="/home/$user/.sync" sync_directory_path="/home/$user/.sync"
systemd_units_path='/etc/systemd/system' systemd_units_path='/etc/systemd/system'
audio_device='0' audio_device='0'
@ -131,7 +122,6 @@ remote_pubkey='home.pub'
init init
install_packages install_packages
add_users add_users
set_sudo_conf
get_conf get_conf
set_conf set_conf
set_upmpdcli_service set_upmpdcli_service