File pp-start.sh of Package pinephone-helpers
#!/bin/sh
#AT command functions
run_AT_command() {
script -q -c "echo "$@" | timeout 1 atinout - /dev/EG25.AT -" /dev/null ;
}
get_value_AT_command() {
run_AT_command "$@" | grep $(echo "$@" | sed -e s/"AT+"// -e s/"?"// | cut -f1 -d"=") | cut -f2 -d":" | sed -e s/" "/""/ ;
}
systemctl disable pinephone-boot.service
plymouth display-message --text="Executing first boot script"
# Flashing ANX7688 Firmware
echo "Flashing ANX7688 firmware"
echo 1 > /sys/class/typec/port0/device/flash_eeprom
# Import Contrib repo Key
echo "Importing repository keys"
rpm --import $(rpm --eval %{_datadir})/pp-helpers/repomd.xml.key
# HACK: for Alsa UCM Sound
ln -s $(rpm --eval %{_datadir})/alsa/ucm2/PinePhone/PinePhone.conf $(rpm --eval %{_datadir})/alsa/ucm2/conf.d/simple-card/PinePhone.conf
# HACK: Remove Yast2 as is not adapted for small screens
zypper rm -u -y yast2
zypper al yast2
# HACK: Setup the greetd settings, if it is installed
if [[ -f /etc/greetd/config.toml ]]; then
echo "Installing autologin settings (greetd)"
install -m 0644 -D -t /etc/greetd/ $(rpm --eval %{_datadir})/pp-helpers/config.toml
fi
# HACK: Replace default Plasma wallpaper, if it is possible
# if [[ -f /usr/share/plasma/look-and-feel/org.kde.plasma.phone/contents/plasmoidsetupscripts/org.kde.phone.homescreen.js ]]; then
# echo "Replacing default Plasma Mobile wallpaper"
# sed -i 's/applet.reloadConfig()/applet.currentConfigGroup = new Array ("Wallpaper"\, "org.kde.image"\, "General")\napplet.writeConfig("Image"\, "file:\/\/\/usr\/share\/wallpapers\/opensuse-background.png")\napplet.writeConfig("FillMode"\, "2")\n&/g' /usr/share/plasma/look-and-feel/org.kde.plasma.phone/contents/plasmoidsetupscripts/org.kde.phone.homescreen.js
# fi
#FIXME: This is caused without any changes in our repo, Modem seems to be disabled by default on boot
sudo systemctl enable pinephone-modem-boot.service
if [[ -f /usr/bin/kdeconnect-cli ]]; then
echo "Allowing KDE Connect in the firewall"
firewall-cmd --zone=public --permanent --add-service=kdeconnect-kde
firewall-cmd --reload
fi
if [[ -f /usr/bin/phosh ]]; then
#sudo -u pine gsettings set sm.puri.phoc scale-to-fit true
mkdir -p /home/pine/.config/gtk-3.0/
install -m 0644 -D -t /home/pine/.config/gtk-3.0/ $(rpm --eval %{_datadir})/pp-helpers/gtk.css
mkdir -p /home/pine/.config/systemd/user/default.target.wants/
ln -s /usr/lib/systemd/user/gtherm.service /home/pine/.config/systemd/user/default.target.wants/gtherm.service
fi
QMBNCFG_ACTUAL_CONFIG=$(get_value_AT_command AT+QMBNCFG=\'\"AutoSel\"\'| cut -f2 -d",")
# Read current config
if echo $QMBNCFG_ACTUAL_CONFIG | grep -q 1
then
echo "VoLTE already configured"
else
RET=$(run_AT_command \'AT+QMBNCFG=\"AutoSel\",1\')
if ! echo $RET | grep -q OK
then
echo "Failed to enable VoLTE profile auto selecting: $RET"
fi
fi
plymouth hide-message --text="Executing first boot script"
exit 0