diff --git a/RELEASES.md b/RELEASES.md index 6830808..a68ca96 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -7,8 +7,8 @@ * Enabled old-releases for apt source * Installed base packages * Installed initial build tools and image creation tools -* Replace Firefox with Brave web browser -* Remove miscellaneous packages +* Replaced Firefox with Brave web browser +* Removed miscellaneous packages * Installed EmComm Tools branding * Applied initial GNOME settings * Initial work to improve brightness issues on Panasonic hardware diff --git a/overlay/lib/systemd/system/panasonic-brightness.service b/overlay/lib/systemd/system/panasonic-brightness.service new file mode 100644 index 0000000..e260c7c --- /dev/null +++ b/overlay/lib/systemd/system/panasonic-brightness.service @@ -0,0 +1,11 @@ +[Unit] +Description=Brightness fix for Panasonic hardware +ConditionPathExists=/sys/class/backlight/panasonic +After=multi-user.target + +[Service] +Type=simple +ExecStart=/opt/emcomm-tools/sbin/panasonic-set-brightness.sh + +[Install] +WantedBy=multi-user.target diff --git a/overlay/opt/emcomm-tools/sbin/panasonic-set-brightness.sh b/overlay/opt/emcomm-tools/sbin/panasonic-set-brightness.sh new file mode 100755 index 0000000..04fdd32 --- /dev/null +++ b/overlay/opt/emcomm-tools/sbin/panasonic-set-brightness.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 16 January 2023 +# Updated : 16 March 2024 +# Purpose : Fix screen brightness on Panasonic hardware +# +# Note: This fix is based on the following article: +# https://www.bobjohnson.com/bloghow-to-install-ubuntu-on-a-panasonic-toughbook-cf31/ + +PATH=/opt/emcomm-tools/bin:$PATH + +WatchDriver="/sys/class/backlight/panasonic" +PatchDriver="/sys/class/backlight/intel_backlight" + +if [ ! -d $WatchDriver ]; then + et-log "This is not a Pansonic system. Exiting." + exit 1 +fi + +if [ ! -d $PatchDriver ]; then + et-log "Patch driver directory does not exist: ${PatchDriver}" + exit 1 +fi + +# Get maximum brightness values +WatchMax=$(cat $WatchDriver/max_brightness) +PatchMax=$(cat $PatchDriver/max_brightness) + +SetBrightness () { + # Calculate watch current percentage + WatchAct=$(cat $WatchDriver/actual_brightness) + WatchPer=$(( WatchAct * 100 / WatchMax )) + # Reverse engineer patch brightness to set + PatchAct=$(( PatchMax * WatchPer / 100 )) + echo $PatchAct | sudo tee $PatchDriver/brightness +} + +# When machine boots, set brightness to last saved value +SetBrightness +# Wait forever for user to press Fn keys adjusting brightness up/down. +while (true); do + /usr/bin/inotifywait --event modify $WatchDriver/actual_brightness + SetBrightness +done diff --git a/scripts/fix-panasonic-brightness.sh b/scripts/fix-panasonic-brightness.sh new file mode 100755 index 0000000..c4e93cc --- /dev/null +++ b/scripts/fix-panasonic-brightness.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 16 January 2023 +# Updated : 16 March 2024 +# Purpose : Fix screen brightness on Panasonic hardware + +et-log "Installing Panasonic brightness fix..." + +apt install inotify-tools -y + +if [ ! -e $ET_HOME/sbin ]; then + mkdir -v -p $ET_HOME/sbin + chown -v $ET_USER:$ET_GROUP $ET_HOME/sbin +fi + +cp -v ../overlay/$ET_HOME/sbin/panasonic-set-brightness.sh $ET_HOME/sbin/ +chmod -v 755 $ET_HOME/sbin/panasonic-set-brightness.sh +chown -v $ET_USER:$ET_GROUP $ET_HOME/sbin/* + +cp -v ../overlay/lib/systemd/system/panasonic-brightness.service /lib/systemd/system/ + +systemctl daemon-reload +systemctl enable panasonic-brightness +systemctl start panasonic-brightness diff --git a/scripts/install-ubuntu-image-tools-only.sh b/scripts/install-ubuntu-image-tools-only.sh new file mode 100755 index 0000000..c550105 --- /dev/null +++ b/scripts/install-ubuntu-image-tools-only.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 16 March 2024 +# Purpose : Minimal install of image build tools for Ubuntu +set -e + +. ./env.sh +. ./functions.sh + +exitIfNotRoot + +./bootstrap.sh +./update-apt.sh + +et-log "Installing tools for building custom ISO image" +if ! command -v cubic +then + sudo apt-add-repository universe -y + sudo apt-add-repository ppa:cubic-wizard/release -y + sudo apt update + sudo apt install --no-install-recommends cubic -y +fi