Skip to content

Instantly share code, notes, and snippets.

@denizdogan
Created November 25, 2021 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denizdogan/91b951f69f454645efa7b24b0b46e8fe to your computer and use it in GitHub Desktop.
Save denizdogan/91b951f69f454645efa7b24b0b46e8fe to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# WARNING! USE AT YOUR OWN RISK! Automatically downloads and unpacks the latest
# Tizen Emby app to your USB drive and then ejects the drive for you.
# Requirements:
# - curl
# - diskutil
# - jq
# - plutil
# - unzip
# Change this string to match whatever your usb flash drive has been named.
volume_name="EMBY"
volume_path=$(diskutil list -plist external physical |
plutil -convert json -r -o - -- - |
jq -r ".AllDisksAndPartitions[].Partitions[] | select(.VolumeName==\"${volume_name}\") | .MountPoint")
volume_disk=$(diskutil list -plist external physical |
plutil -convert json -r -o - -- - |
jq -r ".AllDisksAndPartitions[] | . as \$parent | .Partitions[] | select(.VolumeName==\"${volume_name}\") | \$parent.DeviceIdentifier")
if [ -z "${volume_path}" ]; then
echo "Failed to find volume named ${volume_name}!"
exit 1
fi
if [ -z "${volume_name}" ]; then
echo "Failed to find disk of volume ${volume_name}!"
exit 1
fi
echo "Downloading tizen.zip..."
curl -s -L -o tizen.zip "https://github.com/MediaBrowser/Emby.Releases/blob/master/tizen/tizen.zip?raw=true"
echo "Unpacking to ${volume_path}..."
unzip -o tizen.zip -d "${volume_path}" >/dev/null
echo "Cleaning up..."
rm -f tizen.zip
echo "Unmounting ${volume_name}..."
diskutil quiet unmountDisk "/dev/${volume_disk}"
echo "Ejecting ${volume_name}..."
diskutil quiet eject "/dev/${volume_disk}"
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment