0119-update-rootfs.patch 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in
  2. index af10b8a..19bece2 100644
  3. --- a/UpdateRootfs.sh.in
  4. +++ b/UpdateRootfs.sh.in
  5. @@ -218,6 +218,21 @@ iface wlan0 inet dhcp
  6. EOF
  7. ) >> $GFA_PREFIX/etc/network/interfaces
  8. +FIXINTERFACES=$(
  9. +cat $GFA_PREFIX/etc/network/interfaces |
  10. +awk '
  11. +{
  12. +# remove old version of resolv.conf filling
  13. +if( ($1 == "post-up") && ($2 == "echo") && ($3 == "\"nameserver")) {
  14. + printf("\tdns-nameservers %s\n", substr($4,1,length($4) - 1));
  15. + } else {
  16. + printf("%s\n", $0);
  17. + }
  18. +
  19. +}'
  20. +)
  21. +echo "$FIXINTERFACES" > $GFA_PREFIX/etc/network/interfaces
  22. +
  23. if [ -e $GFA_PREFIX/etc/init.d/S98usb_g_ether ]
  24. then
  25. cp $GFA_PREFIX/etc/init.d/S98usb_g_ether $GFA_PREFIX/etc/init.d/M98usb_g_ether
  26. @@ -390,6 +405,14 @@ else
  27. fi
  28. fi
  29. +if [ "$XRES" == "416" -a "$YRES" == "1280" ]; then
  30. +if [ "$BASEBOARD" == "DISPLAY002_784" ]; then
  31. + echo "4.7 x 7.5 Inch long Display 2"
  32. + sh /root/Display2To_784inch_rs485.sh
  33. + DONE=1
  34. +fi
  35. +fi
  36. +
  37. if [ "$DONE" == "0" ]; then
  38. echo "Unknown Display Resolution"
  39. fi
  40. @@ -404,6 +427,7 @@ echo "restart system !!!"
  41. sleep 2
  42. #-----------------
  43. reboot
  44. +exit 0
  45. fi
  46. fi
  47. #====================== DoRealUpdate ==== Ende =====
  48. @@ -641,7 +665,13 @@ cat << XEOF
  49. CALLDIR=\`pwd\`
  50. WRKDIR=/opt/GfA/SDUpdateTool
  51. -
  52. +
  53. +if [ -z "\$1" ]; then
  54. + CUSTOM_ROOT=\$WRKDIR/custom_root
  55. +else
  56. + CUSTOM_ROOT=\$WRKDIR/\$1
  57. +fi
  58. +
  59. DESTDEV="/dev/mmcblk1"
  60. EMMC_BOOTPATH="/tmp/EMMCBOOT"
  61. @@ -702,6 +732,14 @@ then
  62. rm \$GFA_PREFIX/etc/wpa_supplicant/wpa_supplicant.conf
  63. fi
  64. +#=== execute custom_pre script =====
  65. +GFA_NEWROOTFS=\$WRKDIR/_BootRoot
  66. +if [ -x "\$WRKDIR/custom_pre.sh" ]; then
  67. + SAVEDIR=\`pwd\`
  68. + \$WRKDIR/custom_pre.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS
  69. + cd \$SAVEDIR
  70. +fi
  71. +
  72. #=== copy ROOTFS
  73. cd \$WRKDIR/_BootRoot
  74. rsync -avR --exclude=/_GfABoot \\
  75. @@ -727,6 +765,7 @@ iface lo inet loopback
  76. EOF
  77. ) > \$GFA_PREFIX/etc/network/interfaces
  78. +
  79. awk -v par=\$INTERFACE '/^iface/ && \$2==par {f=1}/^iface/ && \$2!=par {f=0}f && !/^\s*#/d && !/^\s*\$/d {print \$0 }' \$TMP_PATH/bu_cfg/interfaces \\
  80. >> \$GFA_PREFIX/etc/network/interfaces
  81. @@ -744,6 +783,21 @@ iface wlan0 inet dhcp
  82. EOF
  83. ) >> \$GFA_PREFIX/etc/network/interfaces
  84. +FIXINTERFACES=\$(
  85. +cat \$GFA_PREFIX/etc/network/interfaces |
  86. +awk '
  87. +{
  88. +# remove old version of resolv.conf filling
  89. +if( (\$1 == "post-up") && (\$2 == "echo") && (\$3 == "\"nameserver")) {
  90. + printf("\tdns-nameservers %s\n", substr(\$4,1,length(\$4) - 1));
  91. + } else {
  92. + printf("%s\n", \$0);
  93. + }
  94. +
  95. +}'
  96. +)
  97. +echo "\$FIXINTERFACES" > \$GFA_PREFIX/etc/network/interfaces
  98. +
  99. if [ -e \$GFA_PREFIX/etc/init.d/S98usb_g_ether ]
  100. then
  101. cp \$GFA_PREFIX/etc/init.d/S98usb_g_ether \$GFA_PREFIX/etc/init.d/M98usb_g_ether
  102. @@ -794,7 +848,7 @@ then
  103. sed -i 's/TSYNCCMD=rdate time.memod.de/TSYNCCMD=\/etc\/init.d\/S99rtc_GfA set/' \$GFA_PREFIX/var/GfA/Display_GSM.ini
  104. fi
  105. #================================
  106. -#--create mountable run folder insted of link
  107. +#--create mountable run folder instead of link
  108. RUNDIR=\$GFA_PREFIX/run
  109. if [ -L \$RUNDIR ]; then
  110. mv \$RUNDIR \$RUNDIR'_WRK'
  111. @@ -839,12 +893,18 @@ chown -Rv \${UID_PG}:\${GID_PG} \$GFA_PREFIX/var/lib/pgsql
  112. chmod 700 \$GFA_PREFIX/root/.ssh
  113. #===== copy custom_root files if folder exists
  114. -if [ -d "\$WRKDIR/custom_root" ]; then
  115. - cd \$WRKDIR/custom_root
  116. +if [ -d "\$CUSTOM_ROOT" ]; then
  117. + cd \$CUSTOM_ROOT
  118. rsync -avR \\
  119. ./ \$EMMC_ROOTPATH/
  120. fi
  121. #==============================================================================
  122. +#=== execute custom_post script =====
  123. +if [ -x "\$WRKDIR/custom_post.sh" ]; then
  124. + SAVEDIR=\`pwd\`
  125. + \$WRKDIR/custom_post.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS
  126. + cd \$SAVEDIR
  127. +fi
  128. #=== copy BOOTFS
  129. rm -rf \$EMMC_BOOTPATH/*
  130. cd \$WRKDIR/_BootRoot/_GfABoot
  131. @@ -924,6 +984,14 @@ else
  132. fi
  133. fi
  134. +if [ "\$XRES" == "416" -a "\$YRES" == "1280" ]; then
  135. +if [ "\$BASEBOARD" == "DISPLAY002_784" ]; then
  136. + echo "15 Inch Display 2"
  137. + cp \$EMMC_BOOTPATH/Display002_784_rs485.dtb \$EMMC_BOOTPATH/Display001.dtb
  138. + DONE=1
  139. +fi
  140. +fi
  141. +
  142. if [ "\$DONE" == "0" ]; then
  143. echo "Unknown Display Resolution"
  144. fi
  145. @@ -941,17 +1009,25 @@ fi
  146. #===== MakeSDUpdateTool === End
  147. #====== HELP on unknown Command =======
  148. -echo -e "Unknown Command :: $1"
  149. -echo -e "Usage: $0 \e[32m[Command]\e[0m"
  150. -echo -e "\t without command ... update to new system"
  151. -echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults"
  152. -echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults"
  153. -echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for"
  154. -echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool"
  155. -echo -e "\t\t To Do UpdateEMMC:"
  156. -echo -e "\t\t\t cd /opt/GfA/SDUpdateTool"
  157. -echo -e "\t\t\t ./UpdateEMMC.sh"
  158. -echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists"
  159. -echo -e "\t\t\t whole tree will be copied to root filesystem as is"
  160. -
  161. +if [ $# > 1 ]; then
  162. + echo -e "Unknown Command :: $1"
  163. + echo -e "Usage: $0 \e[32m[Command]\e[0m"
  164. + echo -e "\t without command ... update to new system"
  165. + echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults"
  166. + echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults"
  167. + echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for"
  168. + echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool"
  169. + echo -e "\t\t To Do UpdateEMMC:"
  170. + echo -e "\t\t\t cd /opt/GfA/SDUpdateTool"
  171. + echo -e "\t\t\t ./UpdateEMMC.sh [custom_root_path relative to /opt/GfA/SDUpdateTool]"
  172. + echo -e "\t\t\t default ... custom_root"
  173. + echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists"
  174. + echo -e "\t\t\t whole tree will be copied to root filesystem as is"
  175. + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_pre.sh exists"
  176. + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS"
  177. + echo -e "\t\t\t before copy to EMMC starts"
  178. + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_post. exists"
  179. + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS"
  180. + echo -e "\t\t\t after copy to EMMC is finished"
  181. +fi
  182. exit 0