-
Notifications
You must be signed in to change notification settings - Fork 27
/
aipupgrade
executable file
·48 lines (45 loc) · 1.78 KB
/
aipupgrade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#aipupgrade is a script that removes the submissionDocumentation directory, removes DSStore files, asks and logs package type, and creates new metadata.
SCRIPTDIR=$(dirname $(which "${0}"))
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ;};
_report -d "Select a package type:"
PS3="Selection? "
select PACKAGETYPE in "Production" "Preservation-Video" "Preservation-Document" "Preservation-Audio" "Unedited"
do
break
done
echo "You've selected ${PACKAGETYPE} as your package type."
while [ "${*}" != "" ] ; do
echo "Now I'm removing the SubmissionDocumentation directory and .DSStore files."
INPUT="${1}"
echo "The input is ${INPUT}"
SUBDOC="${INPUT}/metadata/submissionDocumentation/"
METADOC="${INPUT}/metadata/"
echo "${METADOC}"
shift
"${SCRIPTDIR}/removeDSStore" "${INPUT}"
#remove unecessary directory
if [ -d "${SUBDOC}" ] ; then
mv -v -n "${SUBDOC}"* "${METADOC}"
rmdir "${SUBDOC}"
fi
echo "Now I'm going to create a capture log (if needed) and record the package type."
LOGDIR="${INPUT}/metadata/logs"
INGESTLOG="${LOGDIR}/capture.log"
_mkdir2 "${LOGDIR}"
echo "" >> "${INGESTLOG}"
INGESTPACKAGETYPE=$(_readingestlog "package type")
if [[ ! "${INGESTPACKAGETYPE}" ]] ; then
echo "Creating capture log with package type."
if [[ ! -f "${INGESTLOG}" ]] ; then
_writeingestlog "made this" "aipupgrade"
fi
MADETHIS=$(_readingestlog "made this")
if [[ ! "${MADETHIS}" ]] ; then
_writeingestlog "made this" "ingestfile"
fi
_writeingestlog "package type" "${PACKAGETYPE}"
fi
"${SCRIPTDIR}/makemetadata" -r "${INPUT}"
echo "New metadata was created for your package."
done