Skip to content

Instantly share code, notes, and snippets.

@cocus
Created August 4, 2024 03:53
Show Gist options
  • Save cocus/c79b2a3d0fe2b1c4c67736f43dc70bf9 to your computer and use it in GitHub Desktop.
Save cocus/c79b2a3d0fe2b1c4c67736f43dc70bf9 to your computer and use it in GitHub Desktop.
Update thingino config in-place
#!/bin/bash
LOGO_WIDTH=191
LOGO_HEIGHT=167
IP="192.168.100.50"
USER="root"
PASS="root"
UIP="$USER@$IP"
SSHTHING="sshpass -p $USER ssh $UIP"
SCPTHING="sshpass -p $USER scp "
$SCPTHING cocus.bgra $UIP:/
$SCPTHING mqtt-full.sh $UIP:/
# logo is 191 x 167
# pos_logo_x = 1920 - offset (20) - width (191) = 1709
# pos_logo_y = 1080 - offset (20) - height (167) = 893
PRUDYNT_CFG="/etc/prudynt.cfg"
PRUDYNT_TMP="/tmp/prudynt.cfg"
$SSHTHING sh <<EOF
cp $PRUDYNT_CFG $PRUDYNT_TMP
sed -i -r 's/(logo_path: ).*/\1"\/cocus.bgra";/' $PRUDYNT_TMP
sed -i 's/# logo_path:/logo_path:/' $PRUDYNT_TMP
sed -i -r 's/(logo_width: ).*/\1$LOGO_WIDTH;/' $PRUDYNT_TMP
sed -i 's/# logo_width:/logo_width:/' $PRUDYNT_TMP
sed -i -r 's/(logo_height: ).*/\1$LOGO_HEIGHT;/' $PRUDYNT_TMP
sed -i 's/# logo_height:/logo_height:/' $PRUDYNT_TMP
sed -i -r 's/(pos_logo_x: ).*/\11709;/' $PRUDYNT_TMP
sed -i 's/# pos_logo_x:/pos_logo_x:/' $PRUDYNT_TMP
sed -i -r 's/(pos_logo_y: ).*/\1893;/' $PRUDYNT_TMP
sed -i 's/# pos_logo_y:/pos_logo_y:/' $PRUDYNT_TMP
sed -i -r 's/(logo_enabled: ).*/\1true;/' $PRUDYNT_TMP
sed -i 's/# logo_enabled:/logo_enabled:/' $PRUDYNT_TMP
sed -i -r 's/(time_format: ).*/\1"%H:%M:%S %d\/%m\/%Y";/' $PRUDYNT_TMP
sed -i -r 's/(input_enabled: ).*/\1true;/' $PRUDYNT_TMP
sed -i 's/# input_enabled:/input_enabled:/' $PRUDYNT_TMP
sed -i -r 's/(input_vol: ).*/\1120;/' $PRUDYNT_TMP
sed -i 's/# input_vol:/input_vol:/' $PRUDYNT_TMP
sed -i -r 's/(input_gain: ).*/\125;/' $PRUDYNT_TMP
sed -i 's/# input_gain:/input_gain:/' $PRUDYNT_TMP
sed -i -r 's/(input_noise_suppression: ).*/\10;/' $PRUDYNT_TMP
sed -i 's/# input_noise_suppression:/input_noise_suppression:/' $PRUDYNT_TMP
sed -i -r 's/(logo_transparency: ).*/\127;/' $PRUDYNT_TMP
sed -i 's/# logo_transparency:/logo_transparency:/' $PRUDYNT_TMP
cp $PRUDYNT_TMP $PRUDYNT_CFG
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment