[rkward] macports: replace old bundle with stripped version (update_bundle.sh -L)

m.eik michalke null at kde.org
Mon Apr 16 23:39:52 UTC 2018


Git commit 5af95dd208d48b6ba61c6db8eb8781b69dd5c590 by m.eik michalke.
Committed on 16/04/2018 at 23:37.
Pushed by meikm into branch 'master'.

replace old bundle with stripped version (update_bundle.sh -L)

  - previously the new file was written to stripped_$OLDFILENAME, now the old file is renamed orig_$OLDFILENAME
  - added some logic to prevent ending up with orig_orig_orig_... files

M  +24   -8    macports/update_bundle.sh

https://commits.kde.org/rkward/5af95dd208d48b6ba61c6db8eb8781b69dd5c590

diff --git a/macports/update_bundle.sh b/macports/update_bundle.sh
index 4f53ba6c..c7cbcf01 100755
--- a/macports/update_bundle.sh
+++ b/macports/update_bundle.sh
@@ -257,8 +257,14 @@ while getopts ":a:CD:E:d:b:fGlL:pP:rRQqmsS:cU:xXF:t:" OPT; do
        MCPVERS=$OPTARG >&2 ;;
     f) LSDSKUSG=true >&2 ;;
     l) RMSTLIBS=true >&2 ;;
-    L) DOEXCPCK=true
-       MPKGNAME=$OPTARG >&2 ;;
+    L) DOEXCPCK=true >&2
+       MPKGNAME=$OPTARG >&2
+       STRPMPKGFILE="$(basename ${MPKGNAME})" >&2
+       STRPMPKGDIR="$(dirname ${MPKGNAME})" >&2
+       CLEANSTRPMPKGFILE="$(echo ${STRPMPKGFILE} | sed -e "s/^orig_//")"
+       TMPSTRPBUNDLE="${STRPMPKGDIR}/stripped_${CLEANSTRPMPKGFILE}" >&2
+       TARGETSTRPBUNDLE="${STRPMPKGDIR}/${CLEANSTRPMPKGFILE}" >&2
+       NEWORIGBUNDLE="${STRPMPKGDIR}/orig_${CLEANSTRPMPKGFILE}" >&2 ;;
     p) UPMPORTS=true >&2 ;;
     P) POSTINST=true >&2
        POSTINSTFILE=$OPTARG >&2 ;;
@@ -788,26 +794,36 @@ if $DOEXCPCK ; then
       echo -en "\nreplacing ${TXT_BLUE}background.tiff${OFF}..."
       cp "${SRCPATH}/background.tiff" "${BNDLTMP}/bundle/Resources/background.tiff" || warning "failed!"
       alldone
+    else
+      echo -e ""
     fi
     if [ -f "${BNDLTMP}/bundle/Resources/Welcome.html" ] ; then
-      echo -en "\nfixing ${TXT_BLUE}Welcome.html${OFF}..."
+      echo -en "fixing ${TXT_BLUE}Welcome.html${OFF}..."
       sed -i -e "s/kf5-rkward[-binarydevl]*/RKWard/g" "${BNDLTMP}/bundle/Resources/Welcome.html" || warning "failed!"
       alldone
     fi
     if [ -f "${BNDLTMP}/bundle/Distribution" ] ; then
-      echo -en "\nfixing ${TXT_BLUE}Distribution${OFF}..."
+      echo -en "fixing ${TXT_BLUE}Distribution${OFF}..."
       sed -i -e "s|<title>kf5-rkward[-binarydevl]*</title>|<title>RKWard</title>|g" "${BNDLTMP}/bundle/Distribution" || warning "failed!"
       sed -i -e "s|Applications/RKWard/rkward.app|Applications/rkward.app|g" "${BNDLTMP}/bundle/Distribution" || warning "failed!"
       sed -i -e $'s|</allowed-os-versions>|</allowed-os-versions>\\\n    <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>|' "${BNDLTMP}/bundle/Distribution"
       alldone
     fi
-    echo -en "\nre-packing ${TXT_BLUE}stripped_$(basename ${MPKGNAME})${OFF}..."
-    pkgutil --flatten "${BNDLTMP}/bundle" "$(dirname ${MPKGNAME})/stripped_$(basename ${MPKGNAME})" || error "failed!"
+    echo -en "re-packing ${TXT_BLUE}stripped_${CLEANSTRPMPKGFILE}${OFF}..."
+    pkgutil --flatten "${BNDLTMP}/bundle" "${TMPSTRPBUNDLE}" || error "failed!"
+    alldone
+    if ! [ $(echo "${STRPMPKGFILE}" | grep "^orig_") ] ; then
+      echo -en "replacing ${TXT_BLUE}${STRPMPKGFILE}${OFF} with ${TXT_BLUE}stripped_${CLEANSTRPMPKGFILE}${OFF}..."
+      mv "${MPKGNAME}" "${NEWORIGBUNDLE}" || error "failed!"
+    else
+      echo -en "moving ${TXT_BLUE}stripped_${CLEANSTRPMPKGFILE}${OFF}..."
+    fi
+    mv "${TMPSTRPBUNDLE}" "${TARGETSTRPBUNDLE}" || error "failed!"
     alldone
-    echo -en "removing temporary dir ${TXT_BLUE}${BNDLTMP}${OFF}..."
+    echo -en "\nremoving temporary dir ${TXT_BLUE}${BNDLTMP}${OFF}..."
     rm -rf "${BNDLTMP}" 2>/dev/null || error "failed!"
     alldone
-    bundlesize "$(dirname ${MPKGNAME})/stripped_$(basename ${MPKGNAME})"
+    bundlesize "${TARGETSTRPBUNDLE}"
   else
     error "${TXT_BLUE}${BNDLTMP}${OFF} exists, can't unpack the bundle archive!"
   fi



More information about the rkward-tracker mailing list