From 5049c745b1921f3957cd319bba0ce888d95f4461 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Sat, 5 Jun 2010 11:53:25 +0200 Subject: [PATCH] Hotfix 2: Continued to work on it :) --- recipes/hotfix/2/gui.conf | 2 + recipes/hotfix/2/interfaces | 16 +++ recipes/hotfix/2/op_bluetooth.desktop | 9 ++ recipes/hotfix/2/op_bluetooth.sh | 32 ++++++ recipes/hotfix/2/op_calibrate.sh | 3 + recipes/hotfix/2/op_datetime.sh | 36 +++++++ recipes/hotfix/2/op_lcdsettings.sh | 72 ++++++++++++++ recipes/hotfix/2/op_nubmode.sh | 135 ++++++++++++++++++++++++++ recipes/hotfix/2/op_startupmanager.sh | 58 +++++++++++ recipes/hotfix/2/op_switchgui.sh | 18 ++++ recipes/hotfix/2/op_usermanager.sh | 68 +++++++++++++ recipes/hotfix/2/stopmmenu | 3 + recipes/hotfix/updater1.sh | 90 ++++++++++------- 13 files changed, 509 insertions(+), 33 deletions(-) create mode 100644 recipes/hotfix/2/gui.conf create mode 100644 recipes/hotfix/2/interfaces create mode 100644 recipes/hotfix/2/op_bluetooth.desktop create mode 100644 recipes/hotfix/2/op_bluetooth.sh create mode 100755 recipes/hotfix/2/op_calibrate.sh create mode 100755 recipes/hotfix/2/op_datetime.sh create mode 100755 recipes/hotfix/2/op_lcdsettings.sh create mode 100755 recipes/hotfix/2/op_nubmode.sh create mode 100755 recipes/hotfix/2/op_startupmanager.sh create mode 100755 recipes/hotfix/2/op_switchgui.sh create mode 100755 recipes/hotfix/2/op_usermanager.sh create mode 100755 recipes/hotfix/2/stopmmenu diff --git a/recipes/hotfix/2/gui.conf b/recipes/hotfix/2/gui.conf new file mode 100644 index 0000000..6986266 --- /dev/null +++ b/recipes/hotfix/2/gui.conf @@ -0,0 +1,2 @@ +XFCE4;The full desktop Environment;startxfce4;xfce4-session-logout --logout +MiniMenu;A very simple but flexible menu;startmmenu;stopmmenu diff --git a/recipes/hotfix/2/interfaces b/recipes/hotfix/2/interfaces new file mode 100644 index 0000000..afbcf20 --- /dev/null +++ b/recipes/hotfix/2/interfaces @@ -0,0 +1,16 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +auto lo +iface lo inet loopback + +# Wireless interfaces +iface wlan0 inet dhcp + wireless_mode managed + wireless_essid any + wpa-driver wext + wpa-conf /etc/wpa_supplicant.conf + +# Bluetooth networking +iface bnep0 inet dhcp + diff --git a/recipes/hotfix/2/op_bluetooth.desktop b/recipes/hotfix/2/op_bluetooth.desktop new file mode 100644 index 0000000..4009873 --- /dev/null +++ b/recipes/hotfix/2/op_bluetooth.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Toggle Bluetooth Status +Comment=Toggle the status of your Bluetooth device. +StartupNotify=false +Exec=/usr/pandora/scripts/op_bluetooth.sh +Icon=bluetooth +Terminal=false +Type=Application +Categories=System; diff --git a/recipes/hotfix/2/op_bluetooth.sh b/recipes/hotfix/2/op_bluetooth.sh new file mode 100644 index 0000000..cf33851 --- /dev/null +++ b/recipes/hotfix/2/op_bluetooth.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Released under the GPL + +INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`" +LOCK="~/.op_btenabled" + +if [ $1 = "startup" ]; then + [ -f "$LOCK" ] && sudo /usr/sbin/hciconfig "$INTERFACE" up pscan 1>/dev/null && sudo /usr/sbin/bluetoothd || echo "Bluetooth: User has not enabled Bluetooth." + +else + + # Figure out if Bluetooth is running or not + + if hciconfig "$INTERFACE" | grep UP &>/dev/null + then + notify-send -u normal "Bluetooth" "Bluetooth is being disabled..." -i blueman -t 5000 + sudo /usr/sbin/hciconfig ${INTERFACE} down 1>/dev/null + rm -f "$LOCK" + else + pgrep bluetoothd + echo $INTERFACE + if [ $? -ne 1 ]; then + notify-send -u normal "Bluetooth" "Bluetooth is being enabled..." -i blueman -t 5000 + sudo /usr/sbin/hciconfig ${INTERFACE} down 1>/dev/null + sudo /usr/sbin/hciconfig ${INTERFACE} up pscan 1>/dev/null + sudo /usr/sbin/bluetoothd 1>/dev/null + touch "$LOCK" + + fi + fi +fi diff --git a/recipes/hotfix/2/op_calibrate.sh b/recipes/hotfix/2/op_calibrate.sh new file mode 100755 index 0000000..99a3ff2 --- /dev/null +++ b/recipes/hotfix/2/op_calibrate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +TSLIB_CONSOLEDEVICE=none op_runfbapp ts_calibrate +zenity --info --title="Calibration" --text "The touchscreen has been calibrated. To activate the new settings, you have to reboot your unit." \ No newline at end of file diff --git a/recipes/hotfix/2/op_datetime.sh b/recipes/hotfix/2/op_datetime.sh new file mode 100755 index 0000000..fd178be --- /dev/null +++ b/recipes/hotfix/2/op_datetime.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Set the timezone and date/time + +while ! timezone=$(zenity --list --title "Select your time zone" --text="Please select your time zone" --column="Select your time zone" --print-column=1 "GMT (London, Lisbon, Portugal, Casablanca, Morocco)" "GMT+1 (Paris, Berlin, Amsterdam, Bern, Stockholm)" "GMT+2 (Athens, Helsinki, Istanbul)" "GMT+3 (Kuwait, Nairobi, Riyadh, Moscow)" "GMT+4 (Abu Dhabi, Iraq, Muscat, Kabul)" "GMT+5 (Calcutta, Colombo, Islamabad, Madras, New Delhi)" "GMT+6 (Almaty, Dhakar, Kathmandu)" "GMT+7 (Bangkok, Hanoi, Jakarta)" "GMT+8 (Beijing, Hong Kong, Kuala Lumpar, Singapore, Taipei)" "GMT+9 (Osaka, Seoul, Sapporo, Tokyo, Yakutsk)" "GMT+10 (Brisbane, Melbourne, Sydney, Vladivostok)" "GMT+11 (Magadan, New Caledonia, Solomon Is)" "GMT+12 (Auckland, Fiji, Kamchatka, Marshall Is., Wellington, Suva)" "GMT-1 (Azores, Cape Verde Is.)" "GMT-2 (Mid-Atlantic)" "GMT-3 (Brasilia, Buenos Aires, Georgetown)" "GMT-4 (Atlantic Time, Caracas)" "GMT-5 (Bogota, Lima, New York)" "GMT-6 (Mexico City, Saskatchewan, Chicago, Guatamala)" "GMT-7 (Denver, Edmonton, Mountain Time, Phoenix, Salt Lake City)" "GMT-8 (Anchorage, Los Angeles, San Francisco, Seattle)" "GMT-9 (Alaska)" "GMT-10 (Hawaii, Honolulu)" "GMT-11 (Midway Island, Samoa)" "GMT-12 (Eniwetok, Kwaialein)" "UTC" "Universal" --width=500 --height=450) || [ "x$timezone" = "x" ] ; do + zenity --title="Error" --error --text="Please select a time zone." --timeout=6 +done +timezone=`echo $timezone | sed 's/(.*)//g'` +echo $timezone +echo rm /etc/localtime && ln -s /usr/share/zoneinfo/Etc/$timezone /etc/localtime + +#Make sure we clean up any leading zeros in the day (as Zenity freaks out) +date_d=`date +%d | sed 's/^0//'` +date_m=`date +%m` +date_y=`date +%Y` + + +while ! date=$(zenity --calendar --text="Please select the current date" --title "Please select the current date" --day=$date_d --month=$date_m --year=$date_y --date-format="%Y%m%d" --width=500) || [ "x$date" = "x" ] ; do + zenity --title="Error" --error --text="Please select the date." --timeout 6 +done + +echo $date + +time_h=`date +%H` +time_m=`date +%M` + +while ! time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM):" --entry-text "$time_h:$time_m") || [ "x$time" = "x" ] ; do + zenity --title="Error" --error --text="Please input the time." --timeout 6 +done + +while ! date -d $time ; do + time=$(zenity --title="Enter actual time" --entry --text "Please enter the time in 24hour format (HH:MM):" --entry-text "$time_h:$time_m") +done + +date +%Y%m%d -s $date +date +%H:%M -s $time diff --git a/recipes/hotfix/2/op_lcdsettings.sh b/recipes/hotfix/2/op_lcdsettings.sh new file mode 100755 index 0000000..49861d5 --- /dev/null +++ b/recipes/hotfix/2/op_lcdsettings.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Released under the GPL +# LCD-Settings, v1.0, written by Michael Mrozek aka EvilDragon 2010. Brightness-Settings-Part written by vimacs. +# This scripts allows you to create, load and save Gamma-Settings and to change the LCD Brightness. + +while mainsel=$(zenity --title="LCD-Settings" --width="300" --height="180" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "bright" "Change LCD Brightness" "gamma" "Manage LCD Gamma"); do + +case $mainsel in + + "bright") + minbright=3 + maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) + curbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness) + device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness + if [ ! $1 ]; then + newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1) + else + newbright=$1 + fi + if [ $newbright ]; then + if [ $newbright -le $minbright ]; then newbright=$minbright; fi + if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi + echo $newbright > $device + fi;; + + "gamma") + if selection=$(cat /etc/pandora/conf/gamma.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Gamma Manager" --list --column "Name" --column "Description" --text "Please select a Gamma Profile" ); then + echo $selection + + gamma=$(grep "$selection" /etc/pandora/conf/gamma.conf | awk -F\; '{print $3}') + + if [ ${gamma} = "syssyscreatenew" ]; then + cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /tmp/gamma.current + op_gammatool + if zenity --question --title="Confirm new gamma setting" --text="Do you want to keep the current gamma setting or revert to the previous one?" --ok-label="Keep it" --cancel-label="Revert"; then + if zenity --question --title="Save as profile" --text="Do you want to save the new gamma setting as new profile?\n\nNote: You can also test it out first and save it later by restarting the Gamma Manager" --ok-label="Save it now" --cancel-label="Don't save it now"; then + while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do + zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6 + done + curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma) + desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.") + echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf + zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6 + fi + else + cat /tmp/gamma.current > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma + fi + elif [ ${gamma} = "syssyssavecurrent" ]; then + curr=$(cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma) + while ! name=$(zenity --title="Save current settings" --entry --text "Please enter a Name for the new profile.") || [ "x$name" = "x" ] ; do + zenity --title="Error" --error --text="Please enter a name for the profile.." --timeout 6 + done + desc=$(zenity --title="Save current settings" --entry --text "Please enter a description for the new profile.") + echo "$name;$desc;$curr" >> /etc/pandora/conf/gamma.conf + zenity --info --title="Profile created" --text "The current gamma settings have been saved as a new profile." --timeout 6 + elif [ ${gamma} = "syssysdeleteprofile" ]; then + if selection2=$(cat /etc/pandora/conf/gamma.conf | grep -v syssys | awk -F\; '{print $1 "\n" $2 }' | zenity --width=700 --height=400 --title="Delete gamma profile" --list --column "Name" --column "Description" --text "Please select a Gamma Profile to Delete" ); then + if zenity --question --title="Confirm Profile Removal" --text="Are you REALLY sure you want to remove the profile $selection2?\n\nThere will be NO other confirmation and this can NOT be undone!" --ok-label="Yes, remove the profile!" --cancel-label="Don't remove the profile"; then + remove=$(grep "$selection2" /etc/pandora/conf/gamma.conf) + cat /etc/pandora/conf/gamma.conf | grep -v "$remove" > /tmp/gamma.conf + mv /tmp/gamma.conf /etc/pandora/conf/gamma.conf + zenity --info --title="Profile deleted" --text "The profile has been deleted." --timeout 6 + else + zenity --info --title="Profile not deleted" --text "The profile has not been deleted." --timeout 6 + fi + fi + else + echo $gamma > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma + fi + fi;; +esac +done \ No newline at end of file diff --git a/recipes/hotfix/2/op_nubmode.sh b/recipes/hotfix/2/op_nubmode.sh new file mode 100755 index 0000000..e2d8e1d --- /dev/null +++ b/recipes/hotfix/2/op_nubmode.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# Released under the GPL +# Nub-Settings, v1.1, written by Michael Mrozek aka EvilDragon 2010 +# This scripts allows you to configure all parameters of the Pandora-Nubs. The left and right nub can both be configured individually. + +while mainsel=$(zenity --title="Nub-Configuration" --width="380" --height="200" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "leftnub" "Configure left nub" "rightnub" "Configure right nub" "default" "Restore default settings for both nubs"); do + +case $mainsel in + "leftnub") + + while leftsel=$(zenity --title="Configure Left Nub" --width="430" --height="300" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "nub0mode" "Change Nub mode" "nub0msense" "Change the mouse speed" "nub0ssense" "Change the scroll sensitivity" "nub0rate" "Change the scroll speed" "nub0thres" "Change the mouse button sensitivity" "nub0reset" "Reset Nub"); do + case $leftsel in + + "nub0mode") + if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the left nub" --text="Please select the mode for the left nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves." --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then + + echo $nubm > /proc/pandora/nub0/mode + fi;; + + "nub0msense") + curmsense=$(cat /proc/pandora/nub0/mouse_sensitivity) + newmsense=$(zenity --scale --text "Set speed for left nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1) + echo $newmsense > /proc/pandora/nub0/mouse_sensitivity + ;; + + "nub0ssense") + curssense=$(cat /proc/pandora/nub0/scrollx_sensitivity) + newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1) + echo $newssense > /proc/pandora/nub0/scrollx_sensitivity + curssense=$(cat /proc/pandora/nub0/scrolly_sensitivity) + newssense=$(zenity --scale --text "Set the scroll sensitivity for the left nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1) + echo $newssense > /proc/pandora/nub0/scrolly_sensitivity + ;; + + "nub0rate") + currate=$(cat /proc/pandora/nub0/scroll_rate) + newrate=$(zenity --scale --text "Set the scroll speed for the left nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1) + echo $newrate > /proc/pandora/nub0/scroll_rate + ;; + + "nub0thres") + curthres=$(cat /proc/pandora/nub0/mbutton_threshold) + newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the left nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1) + echo $newthres > /proc/pandora/nub0/mbutton_threshold + ;; + + "nub0reset") + echo 1 > /sys/bus/i2c/drivers/vsense/3-0066/reset + sleep 1 + echo 0 > /sys/bus/i2c/drivers/vsense/3-0066/reset + curmode=$(cat /proc/pandora/nub0/mode) + echo mouse > /proc/pandora/nub0/mode + while ! zenity --question --title="Resetted left nub" --text="The left nub has been resetted.\nPlease try to move the mouse cursor\nto test if it is working properly." --ok-label="Working properly" --cancel-label="Reset again"; do + echo 1 > /sys/bus/i2c/drivers/vsense/3-0066/reset + sleep 1 + echo 0 > /sys/bus/i2c/drivers/vsense/3-0066/reset + done + echo $curmode > /proc/pandora/nub0/mode + ;; + esac + done + ;; + + "rightnub") + + while rightsel=$(zenity --title="Configure Right Nub" --width="430" --height="300" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "nub1mode" "Change Nub mode" "nub1msense" "Change the mouse speed" "nub1ssense" "Change the scroll sensitivity" "nub1rate" "Change the scroll speed" "nub1thres" "Change the mouse button sensitivity" "nub1reset" "Reset Nub"); do + case $rightsel in + + "nub1mode") + if nubm=$(zenity --height=300 --list --title="Select Nub-mode for the right nub" --text="Please select the mode for the right nub.\n\nNote: This can affect running programs.\nSome programs also may change the nub mode themselves." --column "return" --hide-column=1 --column "Nub Mode" "mouse" "Use the nub as mouse" "mbuttons" "Use the nub for mousebuttons" "scroll" "Use the nub for scrolling" "absolute" "Use the nub as joystick") ; then + + echo $nubm > /proc/pandora/nub1/mode + fi;; + + "nub1msense") + curmsense=$(cat /proc/pandora/nub1/mouse_sensitivity) + newmsense=$(zenity --scale --text "Set speed for right nub mouse.\nThe default value is 150. Higher value means faster mouse." --min-value=50 --max-value=300 --value=$curmsense --step 1) + echo $newmsense > /proc/pandora/nub1/mouse_sensitivity + ;; + + "nub1ssense") + curssense=$(cat /proc/pandora/nub1/scrollx_sensitivity) + newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the X-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1) + echo $newssense > /proc/pandora/nub1/scrollx_sensitivity + curssense=$(cat /proc/pandora/nub1/scrolly_sensitivity) + newssense=$(zenity --scale --text "Set the scroll sensitivity for the right nub for the Y-Axis.\nThe default value is 7. Higher value means more sensitive.\nA negative value inverts the axis." --min-value=-32 --max-value=32 --value=$curssense --step 1) + echo $newssense > /proc/pandora/nub1/scrolly_sensitivity + ;; + + "nub1rate") + currate=$(cat /proc/pandora/nub1/scroll_rate) + newrate=$(zenity --scale --text "Set the scroll speed for the right nub.\nThe default value is 20. Higher value means more sensitive." --min-value=1 --max-value=40 --value=$currate --step 1) + echo $newrate > /proc/pandora/nub1/scroll_rate + ;; + + "nub1thres") + curthres=$(cat /proc/pandora/nub1/mbutton_threshold) + newthres=$(zenity --scale --text "Change the mousebutton sensitivity for the right nub.\nThe default value is 20.\nThe higher the value the higher you need to move the nub" --min-value=1 --max-value=40 --value=$curthres --step 1) + echo $newthres > /proc/pandora/nub1/mbutton_threshold + ;; + + "nub1reset") + echo 1 > /sys/bus/i2c/drivers/vsense/3-0067/reset + sleep 1 + echo 0 > /sys/bus/i2c/drivers/vsense/3-0067/reset + curmode=$(cat /proc/pandora/nub1/mode) + echo mouse > /proc/pandora/nub1/mode + while ! zenity --question --title="Resetted right nub" --text="The right nub has been resetted.\nPlease try to move the mouse cursor\nto test if it is working properly." --ok-label="Working properly" --cancel-label="Reset again"; do + echo 1 > /sys/bus/i2c/drivers/vsense/3-0067/reset + sleep 1 + echo 0 > /sys/bus/i2c/drivers/vsense/3-0067/reset + done + echo $curmode > /proc/pandora/nub1/mode + ;; + esac + done + ;; + +"default") + echo mouse > /proc/pandora/nub0/mode + echo 150 > /proc/pandora/nub0/mouse_sensitivity + echo 7 > /proc/pandora/nub0/scrollx_sensitivity + echo 7 > /proc/pandora/nub0/scrolly_sensitivity + echo 20 > /proc/pandora/nub0/scroll_rate + echo 20 > /proc/pandora/nub0/mbutton_threshold + echo mbuttons > /proc/pandora/nub1/mode + echo 150 > /proc/pandora/nub1/mouse_sensitivity + echo 7 > /proc/pandora/nub1/scrollx_sensitivity + echo 7 > /proc/pandora/nub1/scrolly_sensitivity + echo 20 > /proc/pandora/nub1/scroll_rate + echo 20 > /proc/pandora/nub1/mbutton_threshold + zenity --info --title="Settings restored" --text "The default nub-settings have been restored." --timeout 6 + ;; +esac +done \ No newline at end of file diff --git a/recipes/hotfix/2/op_startupmanager.sh b/recipes/hotfix/2/op_startupmanager.sh new file mode 100755 index 0000000..7c0c336 --- /dev/null +++ b/recipes/hotfix/2/op_startupmanager.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Released under the GPL +# Startup-Manager, v1.0, written by Michael Mrozek aka EvilDragon 2010 with some help by vimacs. +# This scripts allows you to change various settings of the Pandora startup process. + +while mainsel=$(zenity --title="Startup manager" --width="400" --height="250" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "gui" "Change Default GUI for current user" "login" "Enable/Disable auto login" "user" "Select default user" "wifi" "Enable/Disable WiFi on boot"); do + + +case $mainsel in + +# Change default GUI + "gui") + user2=$(cat /tmp/currentuser) + selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity ---width=500 --height=300 --title="Change the default GUI" --list --column "Name" --column "Description" --text "Please select the GUI you want to run as default startup" ) + + echo $selection + + gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}') + + if [ $gui ]; then + sed -i "s/.*DEFAULT_SESSION=.*/DEFAULT_SESSION=$gui/g" /home/$user2/.xinitrc + zenity --info --title="Changed session" --text "The default session has been changed to $selection." --timeout 6 + fi;; + +# Enable / Disable Autologin + "login") + if zenity --question --title="Autologin" --text="Do you wish to automatically login at startup?\n\nSecurity warning: This skips the password check on startup" --ok-label="Yes" --cancel-label="No"; then + sed -i 's/.*auto_login.*/auto_login yes/g' /etc/slim.conf + zenity --info --title="Changed auto login" --text "Auto login is now enabled." --timeout 6 + else + sed -i 's/.*auto_login.*/auto_login no/g' /etc/slim.conf + zenity --info --title="Changed auto login" --text "Auto login is now disabled." --timeout 6 + fi;; + +# Select default user + "user") + if username=$(cat /etc/passwd | grep /home/ | grep -v root | awk -F\: '{print $1 }' | zenity --width=100 --height=200 --title="Select the default user" --list --column "Username" --text "Please select the default user\nor press Cancel to disable a default user.") ; then + sed -i "s/.*default_user.*/default_user $username/g" /etc/slim.conf + zenity --info --title="Changed default user" --text "The default user is now $username." --timeout 6 + else + echo + sed -i "s/.*default_user.*/default_user/g" /etc/slim.conf + zenity --info --title="Changed default user" --text "The default user disabled" --timeout 6 + fi;; + +# Enable / Disable WiFi on boot + "wifi") + if zenity --question --title="Start WiFi on Bootup" --text="Do you wish to automatically start the WiFi driver on bootup?" --ok-label="Yes" --cancel-label="No"; then + ln -s ../init.d/wl1251-init /etc/rc5.d/S30wl1251-init + ln -s ../init.d/wl1251-init /etc/rc2.d/S30wl1251-init + zenity --info --title="Changed WiFi startup" --text "WiFi on boot is now enabled." --timeout 6 + else + rm /etc/rc2.d/S30wl1251-init + rm /etc/rc5.d/S30wl1251-init + zenity --info --title="Changed WiFi startup" --text "WiFi on boot is now disabled." --timeout 6 + fi;; +esac +done \ No newline at end of file diff --git a/recipes/hotfix/2/op_switchgui.sh b/recipes/hotfix/2/op_switchgui.sh new file mode 100755 index 0000000..d401cd4 --- /dev/null +++ b/recipes/hotfix/2/op_switchgui.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +selection=$(cat /etc/pandora/conf/gui.conf | awk -F\; '{print $1 "\n" $2 }' | zenity --width=500 --height=300 --title="Switch to a different GUI" --list --column "name" --column "description" --text "Select a GUI you want to switch to" ) +echo $selection + +gui=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $3}') +stopnew=$(grep $selection /etc/pandora/conf/gui.conf | awk -F\; '{print $4}') + +echo $gui + +if [ $gui ]; then + echo "$gui" > /tmp/gui.load + echo "$stopnew" > /tmp/gui.stopnew + echo $selection will be started + /tmp/gui.stop +else + exit 0 +fi \ No newline at end of file diff --git a/recipes/hotfix/2/op_usermanager.sh b/recipes/hotfix/2/op_usermanager.sh new file mode 100755 index 0000000..7637cb1 --- /dev/null +++ b/recipes/hotfix/2/op_usermanager.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Released under the GPL +# User-Manager, v1.0, written by Michael Mrozek aka EvilDragon 2010. +# Partly based on the scripts by JohnX/Mer Project - http://wiki.maemo.org/Mer/ +# Reworked for the OpenPandora - John Willis/Michael Mrozek +# This scripts allows you to create and remove users from the Pandora system. + +while selection=$(zenity --title="Usermanager" --list --column "id" --column "Please select" --hide-column=1 --text="What do you want to do?" "add" "Add a user" "remove" "Remove a user" ); do + if [ ${selection} = "add" ]; then + echo "Add user" + if name=$(zenity --title="Enter full name" --entry --text "Please enter a full name for the new user.") ; then + username_guess=$(echo "$name" | cut -d" " -f1 | tr A-Z a-z) + + if username=$(zenity --title="Enter the new username" --entry --text "Please choose a short username.\n\nIt should be all lowercase and contain only letters and numbers." --entry-text "$username_guess") || [ "x$username" = "x" ] ; then + + while ! useradd -c "$name,,," -G adm,audio,video,wheel,netdev,plugdev,users "$username" ; do + username=$(zenity --title="Please check username" --entry --text "Please ensure that your username consists of only\nletters and numbers and is not already in use on the system." --entry-text "$username") + done + + password="" + while [ x$password = x ] ; do + password1=$(zenity --title=Password --entry --text="Please choose a new password." --hide-text) + password2=$(zenity --title=Confirm --entry --text="Confirm your new password." --hide-text) + if [ $password1 != $password2 ] ; then + zenity --title="Error" --error --text="The passwords do not match.\n\nPlease try again." --timeout 6 + else + if [ x$password1 = x ] ; then + zenity --title="Error" --error --text="Password cannot be blank!\n\nPlease try again." --timeout 6 + else + password=$password1 + fi + fi + done + +passwd "$username" <> /tmp/updatedetail.log currfree=$(df /boot | grep boot | awk '{print $4}') if [ $currfree -lt $needfree ]; then err="There is not enough diskspace on /boot/ to update the kernel.\n\nKernel couldn't be updated." echo "Kernel not updated - not enough diskspace on /boot/" >> /tmp/updater.log else - cp 1/uImage /boot/uImage.new + cp 1/uImage /boot/uImage.new >> /tmp/updatedetail.log sync currkern=$(md5sum /boot/uImage.new | cut -d" " -f1) if [ $currkern = $newkern ]; then - mv /boot/uImage /boot/uImage.old - mv /boot/uImage.new /boot/uImage + mv /boot/uImage /boot/uImage.old >> /tmp/updatedetail.log + mv /boot/uImage.new /boot/uImage >> /tmp/updatedetail.log currkern=$(md5sum /boot/uImage | cut -d" " -f1) if [ $currkern != $newkern ]; then - rm /boot/uImage - mv /boot/uImage.old /boot/uImage + rm /boot/uImage >> /tmp/updatedetail.log + mv /boot/uImage.old /boot/uImage >> /tmp/updatedetail.log err="There was a checksum error while copying the kernel.\n\nKernel couldn't be updated. Please check your SD-Card and try to recopy the PND-File." echo "Kernel not updated - checksum error" >> /tmp/updater.log fi else - rm /boot/uImage.new + rm /boot/uImage.new >> /tmp/updatedetail.log err="There was a checksum error while copying the kernel.\n\nKernel couldn't be updated. Please check your SD-Card and try to recopy the PND-File." echo "Kernel not updated - checksum error" >> /tmp/updater.log fi @@ -62,12 +63,12 @@ echo "# Updating kernel if needed" echo "20" echo "# Installing missing Python libraries" -if [ ! -f /usr/lib/glob.py ]; - opkg install 1/gnome-vfs-plugin-ftp_2.24.1-r2.5_armv7a.ipk 1/gnome-vfs-plugin-http_2.24.1-r2.5_armv7a.ipk 1/python-pycairo_1.4.0-ml3.5_armv7a.ipk 1/python-pygtk_2.16.0-r1.5_armv7a.ipk 1/python-shell_2.6.4-ml9.1.5_armv7a.ipk - echo "Python libraries successfully updated" >> /tmp/updater.log - sync +if [ "`opkg list-installed | grep python-shell`" ]; then + echo "Python libraries were already installed." >> /tmp/updater.log else - echo "Python libraries were installed." >> /tmp/updater.log + opkg install 1/gnome-vfs-plugin-ftp_2.24.1-r2.5_armv7a.ipk 1/gnome-vfs-plugin-http_2.24.1-r2.5_armv7a.ipk 1/python-pycairo_1.4.0-ml3.5_armv7a.ipk 1/python-pygtk_2.16.0-r1.5_armv7a.ipk 1/python-shell_2.6.4-ml9.1.5_armv7a.ipk >> /tmp/updatedetail.log + echo "Python libraries installed" >> /tmp/updater.log + sync fi # HotFix 2 @@ -76,28 +77,28 @@ fi echo "30" echo "# Installing updated MiniMenu" if [ $oldmmenu1 = $currmmenu -o $oldmmenu2 = $currmenu]; then - rm /usr/bin/mmenu.old - cp 2/mmenu /usr/bin/mmenu.new - cp 2/mmenu.conf /etc/pandora/conf/mmenu.conf.new + rm /usr/bin/mmenu.old >> /tmp/updatedetail.log + cp 2/mmenu /usr/bin/mmenu.new >> /tmp/updatedetail.log + cp 2/mmenu.conf /etc/pandora/conf/mmenu.conf.new >> /tmp/updatedetail.log sync currmmenu=$(md5sum /usr/bin/mmenu.new | cut -d" " -f1) if [ $currmmenu = $newmmenu ]; then - mv /usr/bin/mmenu /usr/bin/mmenu.old - mv /etc/pandora/conf/mmenu.conf /etc/pandora/conf/mmenu.conf.old - mv /usr/bin/mmenu.new /usr/bin/mmenu - mv /etc/pandora/conf/mmenu.conf.new /etc/pandora/conf/mmenu.conf + mv /usr/bin/mmenu /usr/bin/mmenu.old >> /tmp/updatedetail.log + mv /etc/pandora/conf/mmenu.conf /etc/pandora/conf/mmenu.conf.old >> /tmp/updatedetail.log + mv /usr/bin/mmenu.new /usr/bin/mmenu >> /tmp/updatedetail.log + mv /etc/pandora/conf/mmenu.conf.new /etc/pandora/conf/mmenu.conf >> /tmp/updatedetail.log currmmenu=$(md5sum /boot/uImage | cut -d" " -f1) if [ $currmmenu != $newmmenu ]; then - rm /usr/bin/mmenu - rm /etc/pandora/conf/mmenu.conf - mv /etc/pandora/conf/mmenu.conf.old /etc/pandora/conf/mmenu.conf - mv /usr/bin/mmenu.old /usr/bin/mmenu + rm /usr/bin/mmenu >> /tmp/updatedetail.log + rm /etc/pandora/conf/mmenu.conf >> /tmp/updatedetail.log + mv /etc/pandora/conf/mmenu.conf.old /etc/pandora/conf/mmenu.conf >> /tmp/updatedetail.log + mv /usr/bin/mmenu.old /usr/bin/mmenu >> /tmp/updatedetail.log err="There was a checksum error while copying MiniMenu.\n\nMiniMenu couldn't be updated. Please check your SD-Card and try to recopy the PND-File." echo "MiniMenu not updated - checksum error" >> /tmp/updater.log fi else - rm /usr/bin/mmenu.new - rm /etc/pandora/conf/mmenu.conf.new + rm /usr/bin/mmenu.new >> /tmp/updatedetail.log + rm /etc/pandora/conf/mmenu.conf.new >> /tmp/updatedetail.log err="There was a checksum error while copying MiniMenu.\n\nMiniMenu couldn't be updated. Please check your SD-Card and try to recopy the PND-File." echo "MiniMenu not updated - checksum error" >> /tmp/updater.log fi @@ -110,22 +111,45 @@ echo "# Installing updated MiniMenu" echo "40" echo "# Installing Boost Library" -if [ ! -f /usr/lib/libboost_prg_exec_monitor-mt-d.so.1.41.0 ]; - opkg install 2/boost* - echo "Boost library successfully updated" >> /tmp/updater.log +if [ "`opkg list-installed | grep boost-system`" ]; then + echo "Boost library was already installed" >> /tmp/updater.log +else + opkg install 2/boost_1.41.0-r8.1.5_armv7a.ipk 2/boost-filesystem_1.41.0-r8.1.5_armv7a.ipk 2/boost-graph_1.41.0-r8.1.5_armv7a.ipk 2/boost-iostreams_1.41.0-r8.1.5_armv7a.ipk 2/boost-program-options_1.41.0-r8.1.5_armv7a.ipk 2/boost-python_1.41.0-r8.1.5_armv7a.ipk 2/boost-regex_1.41.0-r8.1.5_armv7a.ipk 2/boost-serialization_1.41.0-r8.1.5_armv7a.ipk 2/boost-signals_1.41.0-r8.1.5_armv7a.ipk 2/boost-system_1.41.0-r8.1.5_armv7a.ipk 2/boost-test_1.41.0-r8.1.5_armv7a.ipk >> /tmp/updatedetail.log + echo "Boost library installed" >> /tmp/updater.log sync -else - echo "Boost library was already up-to-date." >> /tmp/updater.log fi # Bugfixes in Scripts echo "50" echo "# Installing updated scripts" - - -) +if [ ! -f /usr/bin/stopmmenu ]; then + cp 2/op_bluetooth.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_calibrate.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_datetime.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_lcdsettings.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_nubmode.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_startupmanager.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_switchgui.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/op_usermanager.sh /usr/pandora/scripts/ >> /tmp/updatedetail.log + cp 2/gui.conf /etc/pandora/conf/ >> /tmp/updatedetail.log + cp 2/op_bluetooth.desktop /usr/share/applications/ >> /tmp/updatedetail.log + cp 2/rc.wl1251 /etc/init.d/wl1251-init >> /tmp/updatedetail.log + cp 2/interfaces /etc/network/ >> /tmp/updatedetail.log + cp 2/stopmmenu /usr/bin/stopmmenu >> /tmp/updatedetail.log + echo "The scripts have been updated" >> /tmp/updater.log + sync +else + echo "The scripts were up-to-date" >> /tmp/updater.log +fi # Zenity Progress goes here fi + + + + + + + -- 2.39.2