Skip to content

Instantly share code, notes, and snippets.

@MagerValp
Created February 14, 2017 16:34
Show Gist options
  • Save MagerValp/663de3b7a6448d3fe505d340cdadb64b to your computer and use it in GitHub Desktop.
Save MagerValp/663de3b7a6448d3fe505d340cdadb64b to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Restore the machine's saved .MASManifest.
echo "===== restore_masmanifest ====="
VARDBPATH="{{target_volume}}/private/var/db"
if [[ -f /tmp/.MASManifest ]]; then
echo "Restoring .MASManifest"
cp -p /tmp/.MASManifest "$VARDBPATH/.MASManifest"
else
echo "No .MASManifest saved"
fi
exit 0
#!/bin/bash
#
# Save a copy of the machine's .MASManifest.
echo "===== save_masmanifest ====="
VARDBPATH="/Volumes/Macintosh HD/private/var/db"
MASDBPATH="$DS_REPOSITORY_PATH/MASManifests"
MASLOGPATH="$MASDBPATH/MASManifest.log"
echo "Checking .MASManifest"
if [[ -f "$VARDBPATH/.MASManifest" ]]; then
md5=$(md5 < "$VARDBPATH/.MASManifest")
if [[ "$md5" == "bbf1e97143f061f2ab2d3ea27ff68da8" ]]; then
echo ".MASManifest is empty"
else
echo "Saving .MASManifest"
cp -p "$VARDBPATH/.MASManifest" /tmp/.MASManifest
# timestamp=$(stat -f '%B' "$VARDBPATH/.MASManifest")
# date=$(date -r $timestamp '+%Y%m%d')
# manifestpath="$MASDBPATH/MASManifest-$md5.plist"
#
# now=$(date '+%Y-%m-%d %H:%M:%S')
# echo "$now name:$DS_COMPUTERNAME model:$DS_MODEL_IDENTIFIER md5:$md5 date:$date" >> "$MASLOGPATH"
#
# if [[ ! -f "$manifestpath" ]]; then
# echo "Adding .MASManifest ($md5 $date) to database"
# cp "$VARDBPATH/.MASManifest" "$manifestpath"
# else
# echo ".MASManifest ($md5 $date) already in database"
# fi
fi
else
echo "No .MASManifest found"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment