diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in index af10b8a..26a41b3 100644 --- a/UpdateRootfs.sh.in +++ b/UpdateRootfs.sh.in @@ -641,7 +641,13 @@ cat << XEOF CALLDIR=\`pwd\` WRKDIR=/opt/GfA/SDUpdateTool - + +if [ -z "\$1" ]; then + CUSTOM_ROOT=\$WRKDIR/custom_root +else + CUSTOM_ROOT=\$WRKDIR/\$1 +fi + DESTDEV="/dev/mmcblk1" EMMC_BOOTPATH="/tmp/EMMCBOOT" @@ -702,6 +708,14 @@ then rm \$GFA_PREFIX/etc/wpa_supplicant/wpa_supplicant.conf fi +#=== execute custom_pre script ===== +GFA_NEWROOTFS=\$WRKDIR/_BootRoot +if [ -x "\$WRKDIR/custom_pre.sh" ]; then + SAVEDIR=\`pwd\` + \$WRKDIR/custom_pre.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS + cd \$SAVEDIR +fi + #=== copy ROOTFS cd \$WRKDIR/_BootRoot rsync -avR --exclude=/_GfABoot \\ @@ -794,7 +808,7 @@ then sed -i 's/TSYNCCMD=rdate time.memod.de/TSYNCCMD=\/etc\/init.d\/S99rtc_GfA set/' \$GFA_PREFIX/var/GfA/Display_GSM.ini fi #================================ -#--create mountable run folder insted of link +#--create mountable run folder instead of link RUNDIR=\$GFA_PREFIX/run if [ -L \$RUNDIR ]; then mv \$RUNDIR \$RUNDIR'_WRK' @@ -839,12 +853,18 @@ chown -Rv \${UID_PG}:\${GID_PG} \$GFA_PREFIX/var/lib/pgsql chmod 700 \$GFA_PREFIX/root/.ssh #===== copy custom_root files if folder exists -if [ -d "\$WRKDIR/custom_root" ]; then - cd \$WRKDIR/custom_root +if [ -d "\$CUSTOM_ROOT" ]; then + cd \$CUSTOM_ROOT rsync -avR \\ ./ \$EMMC_ROOTPATH/ fi #============================================================================== +#=== execute custom_post script ===== +if [ -x "\$WRKDIR/custom_post.sh" ]; then + SAVEDIR=\`pwd\` + \$WRKDIR/custom_post.sh \$EMMC_ROOTPATH \$GFA_NEWROOTFS + cd \$SAVEDIR +fi #=== copy BOOTFS rm -rf \$EMMC_BOOTPATH/* cd \$WRKDIR/_BootRoot/_GfABoot @@ -941,17 +961,25 @@ fi #===== MakeSDUpdateTool === End #====== HELP on unknown Command ======= -echo -e "Unknown Command :: $1" -echo -e "Usage: $0 \e[32m[Command]\e[0m" -echo -e "\t without command ... update to new system" -echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults" -echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults" -echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for" -echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool" -echo -e "\t\t To Do UpdateEMMC:" -echo -e "\t\t\t cd /opt/GfA/SDUpdateTool" -echo -e "\t\t\t ./UpdateEMMC.sh" -echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists" -echo -e "\t\t\t whole tree will be copied to root filesystem as is" - +if [ $# > 1 ]; then + echo -e "Unknown Command :: $1" + echo -e "Usage: $0 \e[32m[Command]\e[0m" + echo -e "\t without command ... update to new system" + echo -e "\t \e[32mMakeBootableSD\e[0m ... create bootable SD card with factory defaults" + echo -e "\t \e[32mMakeBootableEMMC\e[0m ... create bootable EMMC with factory defaults" + echo -e "\t \e[32mMakeSDUpdateTool\e[0m ... create Folders and scripts for" + echo -e "\t\t updating system from SD Card in /opt/GfA/SDUpdateTool" + echo -e "\t\t To Do UpdateEMMC:" + echo -e "\t\t\t cd /opt/GfA/SDUpdateTool" + echo -e "\t\t\t ./UpdateEMMC.sh [custom_root_path relative to /opt/GfA/SDUpdateTool]" + echo -e "\t\t\t default ... custom_root" + echo -e "\t\t\t if folder /opt/GfASDupdateTool/custom_root exists" + echo -e "\t\t\t whole tree will be copied to root filesystem as is" + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_pre.sh exists" + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS" + echo -e "\t\t\t before copy to EMMC starts" + echo -e "\t\t\t if script (+x) /opt/GfASDupdateTool/custom_post. exists" + echo -e "\t\t\t script will be called with parameters \$1=PATH_TO_EXISTING_ROOTFS \$2=PATH_TO_NEW_ROOTFS" + echo -e "\t\t\t after copy to EMMC is finished" +fi exit 0