Skip to content

Commit e0d77c5

Browse files
committed
Bump to version 2.0.0
1 parent 9369b57 commit e0d77c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4381
-1711
lines changed

Extras/uninstallTranscode.sh

Lines changed: 242 additions & 145 deletions
Large diffs are not rendered by default.

Gem Updater.zip

815 KB
Binary file not shown.

Log Analyzer.zip

721 KB
Binary file not shown.

Settings.zip

705 KB
Binary file not shown.
15.5 MB
Binary file not shown.

Transcode Settings.zip

707 KB
Binary file not shown.

Updater/AutoUpdater.zip

16.5 MB
Binary file not shown.

Updater/SHA256_AU.plist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SHA256checksum</key>
6+
<string>d3344eb0525cf9e5d1e153efd85bfe611afacd5c47920a3caa47210fd48d9bf3</string>
7+
</dict>
8+
</plist>

Updater/Transcode Updater.zip

-357 KB
Binary file not shown.

Updater/updateTranscode.sh

Lines changed: 107 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

3-
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin export PATH
3+
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/Transcode:/usr/local/Transcode/Library export PATH # export PATH to Transcode libraries
44

55
# set -xv; exec 1>>/tmp/updateTranscodeTraceLog 2>&1
66

77
#-----------------------------------------------------------------------------------------------------------------------------------
88
# updateTranscode
9-
# Copyright (c) 2016 Brent Hayward
9+
# Copyright (c) 2016-2017 Brent Hayward
1010
#
1111
#
1212
# This script checks to see if Transcode or Ruby Gems need to be udpated and logs the results to the system log
@@ -16,197 +16,203 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin export PATH
1616
#----------------------------------------------------------FUNCTIONS----------------------------------------------------------------
1717

1818
function define_Constants () {
19-
local versStamp="Version 1.3.1, 08-01-2016"
19+
local versStamp="Version 1.4.2, 03-24-2017"
2020

2121
loggerTag="transcode.update"
2222

2323
local DIR=""
2424
local SOURCE="${BASH_SOURCE[0]}"
2525

26-
while [ -h "${SOURCE}" ]; do # resolve ${SOURCE} until the file is no longer a symlink
26+
while [[ -h "${SOURCE}" ]]; do # resolve ${SOURCE} until the file is no longer a symlink
2727
DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
2828
SOURCE="$(readlink "${SOURCE}")"
29-
[[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}" # if ${SOURCE} was a relative symlink, we need to resolve it relative to the path where the symlink file was located
29+
[[ ${SOURCE} != /* ]] && SOURCE="${DIR}/${SOURCE}" # if ${SOURCE} was a relative symlink, we need to resolve it relative to the path where the symlink file was located
3030
done
3131

32-
readonly comLabel="com.videotranscode.transcode"
32+
readonly LIBDIR="${HOME}/Library"
33+
readonly APPSCRIPTSPATH="/usr/local/Transcode"
34+
readonly LIBSCRIPTSPATH="${APPSCRIPTSPATH}/Library"
3335

34-
readonly libDir="${HOME}/Library"
35-
readonly appScriptsPath="${libDir}/Application Scripts/${comLabel}"
36-
readonly prefDir="${libDir}/Preferences"
37-
readonly workDir=$(aliasPath "${libDir}/Application Support/Transcode/Transcode alias")
36+
readonly PREFDIR="${LIBDIR}/Preferences"
37+
readonly WORKDIR=$(. "_aliasPath.sh" "${LIBDIR}/Application Support/Transcode/Transcode alias")
3838

39-
readonly updaterPath=$(mktemp -d "/tmp/transcodeUpdater_XXXXXXXXXXXX")
40-
41-
readonly sh_echoMsg="${appScriptsPath}/_echoMsg.sh"
42-
readonly sh_ifError="${appScriptsPath}/_ifError.sh"
43-
readonly sh_sendNotification="${appScriptsPath}/_sendNotification.sh"
44-
readonly sh_updatePost="${appScriptsPath}/Transcode Updater.app/Contents/Resources/updateTranscodePost.sh"
45-
readonly plistBuddy="/usr/libexec/PlistBuddy"
46-
readonly versCurrent=$(${plistBuddy} -c 'print :CFBundleShortVersionString' "${appScriptsPath}/Transcode Updater.app/Contents/Resources/transcodeVersion.plist")
39+
readonly UPDATERPATH=$(mktemp -d "/tmp/transcodeUpdater_XXXXXXXXXXXX")
40+
41+
readonly SH_UPDATEPOST="${APPSCRIPTSPATH}/Transcode Updater.app/Contents/Resources/updateTranscodePost.sh"
42+
readonly PLISTBUDDY="/usr/libexec/PlistBuddy"
43+
readonly VERSCURRENT=$(${PLISTBUDDY} -c 'print :CFBundleShortVersionString' "${APPSCRIPTSPATH}/Transcode Updater.app/Contents/Resources/transcodeVersion.plist")
4744

4845
fullUpdate="false"
4946
needsUpdate="false"
50-
SHA1Clean="false"
47+
SHA256Clean="false"
5148
}
5249

5350
function check4Update_Transcode () {
54-
local downloadedZipFile="Transcode Updater.zip"
51+
local downloadedZipFile=""
5552
local capturedOutput=""
5653

57-
. "${sh_echoMsg}" "Checking for Transcode updates..." ""
58-
# get a copy of Transcode Updater.app
59-
curl -L -o "${updaterPath}/${downloadedZipFile}" github.com/bmhayward/Transcode/raw/master/Updater/Transcode%20Updater.zip > /dev/null
60-
# extract the Version.plist from the archive
61-
unzip -j "${updaterPath}/${downloadedZipFile}" "Transcode Updater.app/Contents/Resources/transcodeVersion.plist" -d "${updaterPath}" > /dev/null
62-
# remove any remnants of the unzip
63-
rm -rf "${updaterPath}/__MACOSX"
64-
# check the version numbers for an update
65-
capturedOutput=$(diff --brief "${appScriptsPath}/Transcode Updater.app/Contents/Resources/transcodeVersion.plist" "${updaterPath}/transcodeVersion.plist")
66-
67-
if [[ "${capturedOutput}" = *"differ"* ]]; then
68-
# needs update
54+
downloadedZipFile="Transcode Updater.zip"
55+
56+
. "_echoMsg.sh" "Checking for Transcode updates..." ""
57+
# get a copy of Transcode Updater.app
58+
curl -L -o "${UPDATERPATH}/${downloadedZipFile}" github.com/bmhayward/Transcode/raw/master/Updater/Transcode%20Updater.zip > /dev/null
59+
# extract the Version.plist from the archive
60+
unzip -j "${UPDATERPATH}/${downloadedZipFile}" "Transcode Updater.app/Contents/Resources/transcodeVersion.plist" -d "${UPDATERPATH}" > /dev/null
61+
# remove any remnants of the unzip
62+
rm -rf "${UPDATERPATH}/__MACOSX"
63+
# check the version numbers for an update
64+
capturedOutput=$(diff --brief "${APPSCRIPTSPATH}/Transcode Updater.app/Contents/Resources/transcodeVersion.plist" "${UPDATERPATH}/transcodeVersion.plist")
65+
66+
if [[ "${capturedOutput}" == *"differ"* ]]; then
67+
# needs update
6968
needsUpdate="true"
7069
fi
7170
}
7271

7372
function update_Transcode () {
74-
local waitingPlist="{prefDir}/com.videotranscode.batch.waiting.plist"
75-
local onHoldPlist="{prefDir}/com.videotranscode.batch.onhold.plist"
76-
local workingPlist="{prefDir}/com.videotranscode.batch.working.plist"
77-
local downloadedZipFile="AutoUpdater.zip"
73+
local waitingPlist=""
74+
local onHoldPlist=""
75+
local workingPlist=""
76+
local downloadedZipFile=""
7877
local transcode2Replace=""
7978
local fileType=""
8079
local fileName=""
8180
local versPrevious=""
8281
local versUpdate=""
83-
local auSHA1="SHA1_AU.plist"
84-
local SHA1=""
82+
local auSHA256=""
83+
local SHA256=""
8584
local capturedOutput=""
86-
# can update happen
85+
86+
waitingPlist="{PREFDIR}/com.videotranscode.batch.waiting.plist"
87+
onHoldPlist="{PREFDIR}/com.videotranscode.batch.onhold.plist"
88+
workingPlist="{PREFDIR}/com.videotranscode.batch.working.plist"
89+
downloadedZipFile="AutoUpdater.zip"
90+
auSHA256="SHA256_AU.plist"
91+
# can update happen
8792
if [[ "${needsUpdate}" == "true" ]] && [[ ! -e "${waitingPlist}" || ! -e "${onHoldPlist}" || ! -e "${workingPlist}" ]]; then
88-
# pull down a copy of AutoUpdater
89-
curl -L -o "${updaterPath}/${downloadedZipFile}" github.com/bmhayward/Transcode/raw/master/Updater/${downloadedZipFile} >/dev/null
90-
# pull down a copy of SHA1 checksum
91-
curl -L -o "${updaterPath}/${auSHA1}" github.com/bmhayward/Transcode/raw/master/Updater/SHA1_AU.plist >/dev/null
92-
# read the downloaded SHA1 checksum
93-
auSHA1=$(${plistBuddy} -c 'print :SHA1checksum' "${updaterPath}/${auSHA1}")
94-
# get the SHA1 checksum from the downloaded .zip file
95-
capturedOutput=$(shasum "${updaterPath}/${downloadedZipFile}")
96-
SHA1="${capturedOutput%% *}"
97-
# do the SHA1 checksums match?
98-
if [ "${auSHA1}" == "${SHA1}" ]; then
99-
SHA1Clean="true"
100-
# extract the auto-update to the AutoUpdater directory in the temp folder
101-
unzip "${updaterPath}/${downloadedZipFile}" -d "${updaterPath}/${downloadedZipFile%.*}" >/dev/null
102-
# unzip any applications in the AutoUpdater directory
103-
unzip "${updaterPath}/${downloadedZipFile%.*}/*.zip" -d "${updaterPath}/${downloadedZipFile%.*}" >/dev/null
104-
# delete any embedded zip files
105-
rm -f "${updaterPath}/${downloadedZipFile%.*}"/*.zip
106-
# remove any remnants of the unzip
107-
rm -rf "${updaterPath}/__MACOSX"
108-
rm -rf "${updaterPath}/${downloadedZipFile%.*}/__MACOSX"
109-
# get the known previous version from AutoUpdate
110-
versPrevious=$(${plistBuddy} -c 'print :CFBundleShortVersionString' "${updaterPath}/${downloadedZipFile%.*}/transcodeVersion_Previous.plist")
111-
# get the update version number
112-
versUpdate=$(${plistBuddy} -c 'print :CFBundleShortVersionString' "${updaterPath}/transcodeVersion.plist")
113-
# check to see if a full update needs to be done
114-
if [ "${versCurrent}" != "${versPrevious}" ]; then
115-
# needs full update
93+
# pull down a copy of AutoUpdater
94+
curl -L -o "${UPDATERPATH}/${downloadedZipFile}" github.com/bmhayward/Transcode/raw/master/Updater/${downloadedZipFile} >/dev/null
95+
# pull down a copy of SHA256 checksum
96+
curl -L -o "${UPDATERPATH}/${auSHA256}" github.com/bmhayward/Transcode/raw/master/Updater/SHA256_AU.plist >/dev/null
97+
# read the downloaded SHA256 checksum
98+
auSHA256=$(${PLISTBUDDY} -c 'print :SHA256checksum' "${UPDATERPATH}/${auSHA256}")
99+
# get the SHA256 checksum from the downloaded .zip file
100+
capturedOutput=$(shasum -a 256 "${UPDATERPATH}/${downloadedZipFile}")
101+
SHA256="${capturedOutput%% *}"
102+
# do the SHA256 checksums match?
103+
if [[ "${auSHA256}" == "${SHA256}" ]]; then
104+
SHA256Clean="true"
105+
# extract the auto-update to the AutoUpdater directory in the temp folder
106+
unzip "${UPDATERPATH}/${downloadedZipFile}" -d "${UPDATERPATH}/${downloadedZipFile%.*}" >/dev/null
107+
# unzip any applications in the AutoUpdater directory
108+
unzip "${UPDATERPATH}/${downloadedZipFile%.*}/*.zip" -d "${UPDATERPATH}/${downloadedZipFile%.*}" >/dev/null
109+
# delete any embedded zip files
110+
rm -f "${UPDATERPATH}/${downloadedZipFile%.*}"/*.zip
111+
# remove any remnants of the unzip
112+
rm -rf "${UPDATERPATH}/__MACOSX"
113+
rm -rf "${UPDATERPATH}/${downloadedZipFile%.*}/__MACOSX"
114+
# get the known previous version from AutoUpdate
115+
versPrevious=$(${PLISTBUDDY} -c 'print :CFBundleShortVersionString' "${UPDATERPATH}/${downloadedZipFile%.*}/transcodeVersion_Previous.plist")
116+
# get the update version number
117+
versUpdate=$(${PLISTBUDDY} -c 'print :CFBundleShortVersionString' "${UPDATERPATH}/transcodeVersion.plist")
118+
# check to see if a full update needs to be done
119+
if [[ "${VERSCURRENT}" != "${versPrevious}" ]]; then
120+
# needs full update
116121
fullUpdate="true"
117122
fi
118123

119-
. "${sh_echoMsg}" "Updating Transcode from ${versCurrent} to ${versUpdate}." ""
124+
. "_echoMsg.sh" "Updating Transcode from ${VERSCURRENT} to ${versUpdate}." ""
120125

121-
declare -a updateFiles
122-
updateFiles=( "${updaterPath}/${downloadedZipFile%.*}"/* ) # get a list of filenames with path to convert
126+
declare -a updateFiles_a
127+
updateFiles_a=( "${UPDATERPATH}/${downloadedZipFile%.*}"/* ) # get a list of filenames with path to convert
123128

124-
for i in "${updateFiles[@]}"; do
125-
# get the file extension and file name
129+
for i in "${updateFiles_a[@]}"; do
130+
# get the file extension and file name
126131
fileType="${i##*.}"
127132
fileName="${i##*/}"
128133

129134
case "${fileType}" in
130135
sh|app|command )
131-
# is this file in ~/Library/Application Scripts/com.videotranscode.transcode
132-
transcode2Replace=$(find "${libDir}/Application Scripts/com.videotranscode.transcode" -name "${fileName}")
136+
# is this file in /usr/local/Transcode
137+
transcode2Replace=$(find "${APPSCRIPTSPATH}" -name "${fileName}")
133138

134-
if [ -z "${transcode2Replace}" ]; then
135-
# is this file in /Transcode
136-
transcode2Replace=$(find "${workDir}" -name "${fileName}")
139+
if [[ -z "${transcode2Replace}" ]]; then
140+
if [[ "${transcode2Replace}" != *"_"* ]]; then
141+
# is this file in /Transcode
142+
transcode2Replace=$(find "${APPSCRIPTSPATH}" -name "${fileName}")
143+
else
144+
# is this file in /Transcode/Library
145+
transcode2Replace=$(find "${LIBSCRIPTSPATH}" -name "${fileName}")
146+
fi
137147
fi
138148
;;
139149

140150
workflow )
141-
# file is in ~/Library/Services
142-
transcode2Replace="${libDir}/Services"
151+
# file is in ~/Library/Services
152+
transcode2Replace="${LIBDIR}/Services"
143153
;;
144154
esac
145155

146156
case "${fileType}" in
147157
sh|app|command )
148158
if [[ "${fileName}" != "updateTranscode.sh" && "${fileName}" != "updateTranscodeGems.sh" ]]; then
149-
# move to the update location
159+
# move to the update location
150160
ditto "${i}" "${transcode2Replace}"
151161

152-
. "${sh_echoMsg}" "==> Updated ${fileName}" ""
153-
# this script needs to be updated later, move to /tmp for the moment
154-
elif [ "${fileName}" = "updateTranscode.sh" ]; then
162+
. "_echoMsg.sh" "==> Updated ${fileName}" ""
163+
# this script needs to be updated later, move to /tmp for the moment
164+
elif [[ "${fileName}" == "updateTranscode.sh" ]]; then
155165
ditto "${i}" "/tmp"
156166

157-
. "${sh_echoMsg}" "==> Moved ${fileName} to /tmp" ""
167+
. "_echoMsg.sh" "==> Moved ${fileName} to /tmp" ""
158168
fi
159169

160170
;;
161171

162172
workflow )
163173
cp -R -p "${i}" "${transcode2Replace}"
164174

165-
. "${sh_echoMsg}" "==> Updated ${fileName}" ""
175+
. "_echoMsg.sh" "==> Updated ${fileName}" ""
166176
;;
167177
esac
168178
done
169179

170-
. "${sh_echoMsg}" "Update complete." ""
171-
. "${sh_sendNotification}" "Transcode Update" "Updated from ${versCurrent} to ${versUpdate}"
180+
. "_echoMsg.sh" "Update complete." ""
181+
. "_sendNotification.sh" "Transcode Update" "Updated from ${VERSCURRENT} to ${versUpdate}"
172182
else
173-
# remove the full update flag
183+
# remove the full update flag
174184
fullUpdate="false"
175185

176-
. "${sh_echoMsg}" "SHA1 checksums do not match, update skipped." ""
186+
. "_echoMsg.sh" "SHA256 checksums do not match, update skipped." ""
177187
fi
178188
elif [[ -e "${waitingPlist}" || -e "${onHoldPlist}" || -e "${workingPlist}" ]]; then
179-
. "${sh_echoMsg}" "Update deferred." ""
189+
. "_echoMsg.sh" "Update deferred." ""
180190
else
181-
. "${sh_echoMsg}" "Already up-to-date." ""
191+
. "_echoMsg.sh" "Already up-to-date." ""
182192
fi
183193
}
184194

185195
function clean_Up () {
186-
local plistDir="${libDir}/LaunchAgents"
187-
local plistName="com.videotranscode.gem.check"
188-
local plistFile="${plistDir}/${plistName}.plist"
189196
# delete the auto-update files from /tmp
190-
rm -rf "${updaterPath}"
197+
rm -rf "${UPDATERPATH}"
191198
# make sure everything can execute
192-
find "${appScriptsPath}/" -name "*.sh" -exec chmod +x {} \;
193-
find "${workDir}/" -name "*.command" -exec chmod +x {} \;
194-
find "${workDir}/Extras/" -name "*.command" -exec chmod +x {} \;
199+
find "${APPSCRIPTSPATH}/" -name "*.sh" -exec chmod +x {} \;
200+
find "${APPSCRIPTSPATH}/" -name "*.command" -exec chmod +x {} \;
195201
}
196202

197203
function __main__ () {
198204
define_Constants
199205

200206
check4Update_Transcode
201207
update_Transcode
202-
. "${sh_updatePost}" # executing this way to run an updated version if available
208+
. "${SH_UPDATEPOST}" # executing this way to run an updated version if available
203209
}
204210

205211

206212
#----------------------------------------------------------MAIN----------------------------------------------------------------
207213
# Execute
208214
trap clean_Up INT TERM EXIT # always run clean_Up regardless of how the script terminates
209-
trap '. "${sh_ifError}" ${LINENO} $?' ERR # trap errors
215+
trap '. "_ifError.sh" ${LINENO} $?' ERR # trap errors
210216

211217
__main__
212218

0 commit comments

Comments
 (0)