0113-UpdateRootfs_pre_post_custom_path.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in
  2. index af10b8a..26a41b3 100644
  3. --- a/UpdateRootfs.sh.in
  4. +++ b/UpdateRootfs.sh.in
  5. @@ -641,7 +641,13 @@ cat << XEOF
  6. CALLDIR=\`pwd\`
  7. WRKDIR=/opt/GfA/SDUpdateTool
  8. -
  9. +
  10. +if [ -z "\$1" ]; then
  11. + CUSTOM_ROOT=\$WRKDIR/custom_root
  12. +else
  13. + CUSTOM_ROOT=\$WRKDIR/\$1
  14. +fi
  15. +
  16. DESTDEV="/dev/mmcblk1"
  17. EMMC_BOOTPATH="/tmp/EMMCBOOT"
  18. @@ -702,6 +708,14 @@ then
  19. rm \$GFA_PREFIX/etc/wpa_supplicant/wpa_supplicant.conf
  20. fi
  21. +#=== execute custom_pre script =====
  22. +GFA_NEWROOTFS=\$WRKDIR/_BootRoot
  23. +if [ -x "\$WRKDIR/custom_pre.sh" ]; then
  24. + SAVEDIR=\`pwd\`
  25. + \$WRKDIR/custom_pre.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS
  26. + cd \$SAVEDIR
  27. +fi
  28. +
  29. #=== copy ROOTFS
  30. cd \$WRKDIR/_BootRoot
  31. rsync -avR --exclude=/_GfABoot \\
  32. @@ -794,7 +808,7 @@ then
  33. sed -i 's/TSYNCCMD=rdate time.memod.de/TSYNCCMD=\/etc\/init.d\/S99rtc_GfA set/' \$GFA_PREFIX/var/GfA/Display_GSM.ini
  34. fi
  35. #================================
  36. -#--create mountable run folder insted of link
  37. +#--create mountable run folder instead of link
  38. RUNDIR=\$GFA_PREFIX/run
  39. if [ -L \$RUNDIR ]; then
  40. mv \$RUNDIR \$RUNDIR'_WRK'
  41. @@ -839,12 +853,18 @@ chown -Rv \${UID_PG}:\${GID_PG} \$GFA_PREFIX/var/lib/pgsql
  42. chmod 700 \$GFA_PREFIX/root/.ssh
  43. #===== copy custom_root files if folder exists
  44. -if [ -d "\$WRKDIR/custom_root" ]; then
  45. - cd \$WRKDIR/custom_root
  46. +if [ -d "\$CUSTOM_ROOT" ]; then
  47. + cd \$CUSTOM_ROOT
  48. rsync -avR \\
  49. ./ \$EMMC_ROOTPATH/
  50. fi
  51. #==============================================================================
  52. +#=== execute custom_post script =====
  53. +if [ -x "\$WRKDIR/custom_post.sh" ]; then
  54. + SAVEDIR=\`pwd\`
  55. + \$WRKDIR/custom_post.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS
  56. + cd \$SAVEDIR
  57. +fi
  58. #=== copy BOOTFS
  59. rm -rf \$EMMC_BOOTPATH/*
  60. cd \$WRKDIR/_BootRoot/_GfABoot
  61. @@ -941,17 +961,25 @@ fi
  62. #===== MakeSDUpdateTool === End
  63. #====== HELP on unknown Command =======
  64. -echo -e "Unknown Command :: $1"
  65. -echo -e "Usage: $0 \e[32m[Command]\e[0m"
  66. -echo -e "\t without command ... update to new system"
  67. -echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults"
  68. -echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults"
  69. -echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for"
  70. -echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool"
  71. -echo -e "\t\t To Do UpdateEMMC:"
  72. -echo -e "\t\t\t cd /opt/GfA/SDUpdateTool"
  73. -echo -e "\t\t\t ./UpdateEMMC.sh"
  74. -echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists"
  75. -echo -e "\t\t\t whole tree will be copied to root filesystem as is"
  76. -
  77. +if [ $# > 1 ]; then
  78. + echo -e "Unknown Command :: $1"
  79. + echo -e "Usage: $0 \e[32m[Command]\e[0m"
  80. + echo -e "\t without command ... update to new system"
  81. + echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults"
  82. + echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults"
  83. + echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for"
  84. + echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool"
  85. + echo -e "\t\t To Do UpdateEMMC:"
  86. + echo -e "\t\t\t cd /opt/GfA/SDUpdateTool"
  87. + echo -e "\t\t\t ./UpdateEMMC.sh [custom_root_path relative to /opt/GfA/SDUpdateTool]"
  88. + echo -e "\t\t\t default ... custom_root"
  89. + echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists"
  90. + echo -e "\t\t\t whole tree will be copied to root filesystem as is"
  91. + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_pre.sh exists"
  92. + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS"
  93. + echo -e "\t\t\t before copy to EMMC starts"
  94. + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_post. exists"
  95. + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS"
  96. + echo -e "\t\t\t after copy to EMMC is finished"
  97. +fi
  98. exit 0