Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=17070df973254516d8b63ec16ce3c2d0bfe6a821
commit 17070df973254516d8b63ec16ce3c2d0bfe6a821 Author: James Buren <[email protected]> Date: Thu Nov 21 21:22:16 2013 -0600 fbterm-1.7.0-4-x86_64 * collect information about framebuffer diff --git a/source/apps-extra/fbterm/fbterm-daemon b/source/apps-extra/fbterm/fbterm-daemon index cb08dac..17d7f81 100644 --- a/source/apps-extra/fbterm/fbterm-daemon +++ b/source/apps-extra/fbterm/fbterm-daemon @@ -1,16 +1,54 @@ #!/bin/sh +set -e + # Refuse to run if we are not fbterm user. -if [ "$(id -u)" -ne 85 -o "$(id -g)" -ne 85 ]; then - echo "$0: refusing to run as incorrect user" - exit 1 -fi +#if [ "$(id -u)" -ne 85 -o "$(id -g)" -ne 85 ]; then +# echo "$0: refusing to run as incorrect user" +# exit 1 +#fi + +reduce_fraction() +{ + local factor + local numerator + local denominator + local a + local b + + factor="2" + numerator="$1" + denominator="$2" + + while true; do + a="$(( $numerator % $factor ))" + b="$(( $denominator % $factor ))" + if [ "$a" -ne 0 -o "$b" -ne 0 ]; then + if [ "$factor" -gt "$numerator" -o "$factor" -gt "$denominator" ]; then + break + fi + factor="$(( $factor + 1 ))" + continue + fi + numerator="$(( $numerator / $factor ))" + denominator="$(( $denominator / $factor ))" + done + + echo "${numerator}x${denominator}" +} + +# Change directory to $HOME. +cd $HOME + +# Collect information about the framebuffer resolution. +SIZE="$(cat /sys/class/graphics/fb0/virtual_size | tr ',' 'x')" +ASPECT="$(reduce_fraction $(echo $SIZE | cut -d 'x' -f 1) $(echo $SIZE | cut -d 'x' -f 2))" # Clear screen first. -echo -n -e "\e[2J" +#echo -n -e "\e[2J" # Move cursor to top left. -echo -n -e "\e[1;1H" +#echo -n -e "\e[1;1H" # Hide cursor. #echo -n -e "\e[?25l" _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
