Improved UI of tmimport.sh

Made the help message more helpful, and made a confirmation message
    less whimsical and more clear.
This commit is contained in:
Lee Ockert
2023-10-18 17:48:03 -04:00
parent a577ae5199
commit 1ae26c20b8

View File

@ -1,11 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# BITSC LICENSE NOTICE (MODIFIED ISC LICENSE) # Copyright (c) 2023 Joshua Lee Ockert <torstenvl@gmail.com>
#
# TIME MACHINE IMPORTER
#
# Copyright (c) 2022 Lee Ockert <torstenvl@gmail.com>
# https://github.com/torstenvl
# #
# THIS WORK IS PROVIDED "AS IS" WITH NO WARRANTY OF ANY KIND. THE IMPLIED # THIS WORK IS PROVIDED "AS IS" WITH NO WARRANTY OF ANY KIND. THE IMPLIED
# WARRANTIES OF MERCHANTABILITY, FITNESS, NON-INFRINGEMENT, AND TITLE ARE # WARRANTIES OF MERCHANTABILITY, FITNESS, NON-INFRINGEMENT, AND TITLE ARE
@ -29,21 +24,20 @@ USAGE
DESCRIPTION DESCRIPTION
Time Machine Importer modifies the metadata of a backup drive to match the Time Machine Importer attempts to inherit the backup history of a backup
current computer's model and unique identifiers (primary MAC address and drive. If the backup drive is not paired to the current computer, Time
hardware platform UUID/provisioning UDID) and attempts to 'inherit' the Machine Importer will attempt to pair the drive with the current computer
backup history. by modifying the model, MAC address, and UUID/UDID reflected in the
metadata of the backup drive.
The backup drive should be specified by disk or volume name (or path) or The backup drive should be specified by disk or volume name (or path) or
the mount point of the backup drive. If Time Machine Importer cannot find the mount point of the backup drive. For example:
an appropriate disk volume or mount point, it will check to see if the - ${0} /dev/disk1s1
specified directory is a valid Backups.backupdb location (or a machine - ${0} /Volumes/TMBACKUP
directory under one).
A future version may attempt to detect HFS+ or APFS partitions serving as
backup drives, and, if a backup drive is specified as a device path, it
will automagically choose the correct backup path.
While some additional heuristics may assist in identifying a backup drive
that is specified in other ways, they are untested and not guaranteed
to work correctly.
" "
} }
@ -61,9 +55,6 @@ if [[ $? -eq 0 ]]; then
MOUNTPOINT=`diskutil info ${1} | grep "Mount Point:" | sed 's/^ *Mount Point: *\(.*\)$/\1/'` MOUNTPOINT=`diskutil info ${1} | grep "Mount Point:" | sed 's/^ *Mount Point: *\(.*\)$/\1/'`
if [ "${MOUNTPOINT}" == "" ]; then if [ "${MOUNTPOINT}" == "" ]; then
dispusage "No mount point for specified device ${1}. Perhaps it isn't mounted?" && exit dispusage "No mount point for specified device ${1}. Perhaps it isn't mounted?" && exit
######################################################################################
## TODO: Should check to see if it CONTAINS any disks with a Time Machine role... ##
######################################################################################
fi fi
if [ ! -d "${MOUNTPOINT}/Backups.backupdb/" ]; then if [ ! -d "${MOUNTPOINT}/Backups.backupdb/" ]; then
@ -159,8 +150,8 @@ else
fi fi
select response in "Apply Time Machine Magic" "ABORT ABORT ABORT!"; do select response in "Import Time Machine backup" "ABORT ABORT ABORT!"; do
if [ "${response}" == "Apply Time Machine Magic" ]; then if [ "${response}" == "Import Time Machine backup" ]; then
"${SIMONSAYS}" xattr -w 'com.apple.backupd.ModelID' "${MODEL}" "${BACKUPPATH}" "${SIMONSAYS}" xattr -w 'com.apple.backupd.ModelID' "${MODEL}" "${BACKUPPATH}"
"${SIMONSAYS}" xattr -w 'com.apple.backupd.BackupMachineAddress' "${MAC}" "${BACKUPPATH}" "${SIMONSAYS}" xattr -w 'com.apple.backupd.BackupMachineAddress' "${MAC}" "${BACKUPPATH}"
"${SIMONSAYS}" xattr -w 'com.apple.backupd.HostUUID' "${UUID}" "${BACKUPPATH}" "${SIMONSAYS}" xattr -w 'com.apple.backupd.HostUUID' "${UUID}" "${BACKUPPATH}"