From 2e06b4e961835aff68ac9b032c87455695601869 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 4 Mar 2014 16:19:22 -0600
Subject: [PATCH] bb.org: cleanup pretty things up...

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 target/chroot/beagleboard.org.sh | 73 +++++++++++++++++---------------
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git a/target/chroot/beagleboard.org.sh b/target/chroot/beagleboard.org.sh
index bdf2831a3..76ec0e3bf 100755
--- a/target/chroot/beagleboard.org.sh
+++ b/target/chroot/beagleboard.org.sh
@@ -72,43 +72,46 @@ system_patches () {
 
 setup_desktop () {
 	if [ -d /etc/X11/ ] ; then
-		echo "Section \"Monitor\"" > /etc/X11/xorg.conf
-		echo "        Identifier      \"Builtin Default Monitor\"" >> /etc/X11/xorg.conf
-		echo "EndSection" >> /etc/X11/xorg.conf
-		echo "" >> /etc/X11/xorg.conf
-		echo "Section \"Device\"" >> /etc/X11/xorg.conf
-		echo "        Identifier      \"Builtin Default fbdev Device 0\"" >> /etc/X11/xorg.conf
-		echo "        Driver          \"modesetting\"" >> /etc/X11/xorg.conf
-		echo "        Option          \"SWCursor\"      \"true\"" >> /etc/X11/xorg.conf
-		echo "EndSection" >> /etc/X11/xorg.conf
-		echo "" >> /etc/X11/xorg.conf
-		echo "Section \"Screen\"" >> /etc/X11/xorg.conf
-		echo "        Identifier      \"Builtin Default fbdev Screen 0\"" >> /etc/X11/xorg.conf
-		echo "        Device          \"Builtin Default fbdev Device 0\"" >> /etc/X11/xorg.conf
-		echo "        Monitor         \"Builtin Default Monitor\"" >> /etc/X11/xorg.conf
-		echo "        DefaultDepth    16" >> /etc/X11/xorg.conf
-		echo "EndSection" >> /etc/X11/xorg.conf
-		echo "" >> /etc/X11/xorg.conf
-		echo "Section \"ServerLayout\"" >> /etc/X11/xorg.conf
-		echo "        Identifier      \"Builtin Default Layout\"" >> /etc/X11/xorg.conf
-		echo "        Screen          \"Builtin Default fbdev Screen 0\"" >> /etc/X11/xorg.conf
-		echo "EndSection" >> /etc/X11/xorg.conf
+		wfile="/etc/X11/xorg.conf"
+		echo "Section \"Monitor\"" > ${wfile}
+		echo "        Identifier      \"Builtin Default Monitor\"" >> ${wfile}
+		echo "EndSection" >> ${wfile}
+		echo "" >> ${wfile}
+		echo "Section \"Device\"" >> ${wfile}
+		echo "        Identifier      \"Builtin Default fbdev Device 0\"" >> ${wfile}
+		echo "        Driver          \"modesetting\"" >> ${wfile}
+		echo "        Option          \"SWCursor\"      \"true\"" >> ${wfile}
+		echo "EndSection" >> ${wfile}
+		echo "" >> ${wfile}
+		echo "Section \"Screen\"" >> ${wfile}
+		echo "        Identifier      \"Builtin Default fbdev Screen 0\"" >> ${wfile}
+		echo "        Device          \"Builtin Default fbdev Device 0\"" >> ${wfile}
+		echo "        Monitor         \"Builtin Default Monitor\"" >> ${wfile}
+		echo "        DefaultDepth    16" >> ${wfile}
+		echo "EndSection" >> ${wfile}
+		echo "" >> ${wfile}
+		echo "Section \"ServerLayout\"" >> ${wfile}
+		echo "        Identifier      \"Builtin Default Layout\"" >> ${wfile}
+		echo "        Screen          \"Builtin Default fbdev Screen 0\"" >> ${wfile}
+		echo "EndSection" >> ${wfile}
 	fi
 
-	if [ -f /etc/lightdm/lightdm.conf ] ; then
-		sed -i -e 's:#autologin-user=:autologin-user='$user_name':g' /etc/lightdm/lightdm.conf
-		sed -i -e 's:#autologin-session=UNIMPLEMENTED:autologin-session=LXDE:g' /etc/lightdm/lightdm.conf
+	wfile="/etc/lightdm/lightdm.conf"
+	if [ -f ${wfile} ] ; then
+		sed -i -e 's:#autologin-user=:autologin-user='$user_name':g' ${wfile}
+		sed -i -e 's:#autologin-session=UNIMPLEMENTED:autologin-session=LXDE:g' ${wfile}
 		if [ -f /opt/scripts/3rdparty/xinput_calibrator_pointercal.sh ] ; then
-			sed -i -e 's:#display-setup-script=:display-setup-script=/opt/scripts/3rdparty/xinput_calibrator_pointercal.sh:g' /etc/lightdm/lightdm.conf
+			sed -i -e 's:#display-setup-script=:display-setup-script=/opt/scripts/3rdparty/xinput_calibrator_pointercal.sh:g' ${wfile}
 		fi
 	fi
 
 	cp /opt/scripts/images/beaglebg.jpg /opt/desktop-background.jpg
 
 	mkdir -p /home/${user_name}/.config/pcmanfm/LXDE/ || true
-	echo "[desktop]" > /home/${user_name}/.config/pcmanfm/LXDE/pcmanfm.conf
-	echo "wallpaper_mode=1" >> /home/${user_name}/.config/pcmanfm/LXDE/pcmanfm.conf
-	echo "wallpaper=/opt/desktop-background.jpg" >> /home/${user_name}/.config/pcmanfm/LXDE/pcmanfm.conf
+	wfile="/home/${user_name}/.config/pcmanfm/LXDE/pcmanfm.conf"
+	echo "[desktop]" > ${wfile}
+	echo "wallpaper_mode=1" >> ${wfile}
+	echo "wallpaper=/opt/desktop-background.jpg" >> ${wfile}
 	chown -R ${user_name}:${user_name} /home/${user_name}/.config/
 
 	#Disable LXDE's screensaver on autostart
@@ -118,14 +121,14 @@ setup_desktop () {
 		rm -rf /tmp/autostart || true
 	fi
 
-	file="/etc/udev/rules.d/70-persistent-net.rules"
-	echo "" > ${file}
-	echo "# Auto generated by RootStock-NG: setup_sdcard.sh" >> ${file}
-	echo "# udevadm info -q all -p /sys/class/net/eth0 --attribute-walk" >> ${file}
-	echo "" >> ${file}
-	echo "# BeagleBone: net device ()" >> ${file}
-	echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"eth0\"" >> ${file}
+	wfile="/etc/udev/rules.d/70-persistent-net.rules"
+	echo "" > ${wfile}
+	echo "# Auto generated by RootStock-NG: setup_sdcard.sh" >> ${wfile}
+	echo "# udevadm info -q all -p /sys/class/net/eth0 --attribute-walk" >> ${wfile}
 	echo "" >> ${file}
+	echo "# BeagleBone: net device ()" >> ${wfile}
+	echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"eth0\"" >> ${wfile}
+	echo "" >> ${wfile}
 
 	echo "BeagleBoard.org BeagleBone Debian Image ${release_date}" > /etc/dogtag
 
-- 
GitLab