Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export NODE_ENV=production
- Z_ROOTDIR=data/files
- if [ -z "$1" ]; then
- echo "Usage: $0 filename"
- echo "Example: $0 test.zip"
- exit 1;
- fi
- if [ "$(echo ${1} | grep '/' | wc -l)" -gt 0 ]; then
- Z_REALFILE="${1}"
- else
- # If the full path wasn't specified, try to guess the file location.
- Z_REALFILE=$(ls -1 "${Z_ROOTDIR}/"*/*.zip | grep "${1}")
- fi
- # If we couldn't find the file, stop here
- if [ ! -f "${Z_REALFILE}" ]; then
- echo "Could not find ${Z_REALFILE}"
- exit 1;
- fi
- Z_FILENAME="$(echo "${Z_REALFILE}" | rev | cut -d'/' -f1 | rev)"
- Z_SUBDIR="$(echo "${Z_REALFILE}" | rev | cut -d'/' -f2 | rev)"
- Z_SYSPROP=$(unzip -p "${Z_REALFILE}" system/build.prop)
- Z_DEVICE=$(echo "${Z_SYSPROP}" | grep "ro.product.device=" | head -n1 | cut -d'=' -f2)
- Z_INCID=$(echo "${Z_SYSPROP}" | grep "ro.build.version.incremental=" | cut -d'=' -f2)
- Z_APILVL=$(echo "${Z_SYSPROP}" | grep "ro.build.version.sdk=" | cut -d'=' -f2)
- Z_UPDCH=$(echo "${Z_SYSPROP}" | grep "ro.cm.releasetype=" | cut -d'=' -f2)
- Z_TS=$(echo "${Z_SYSPROP}" | grep "ro.build.date.utc=" | cut -d'=' -f2)
- Z_MD5SUM=$(md5sum -b "${Z_REALFILE}" | cut -d' ' -f1)
- Z_FILESIZE=$(stat -c %s "${Z_REALFILE}")
- node add-build.js \
- --filename "${Z_FILENAME}" \
- --device "${Z_DEVICE}" \
- --incrementalid "${Z_INCID}" \
- --api_level "${Z_APILVL}" \
- --channel "${Z_UPDCH}" \
- --md5sum "${Z_MD5SUM}" \
- --filesize "${Z_FILESIZE}" \
- --subdirectory "${Z_SUBDIR}" \
- --timestamp "${Z_TS}" \
- --active
- echo "${Z_MD5SUM} ${Z_FILENAME}" > "${Z_ROOTDIR}/${Z_SUBDIR}/${Z_FILENAME}.md5sum"
- ./gensite.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement