-
-
Save Nemeziz/80b862595dbd460d91603a598bfd3d02 to your computer and use it in GitHub Desktop.
Bash script to package roku applications.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $1 ]]; then | |
echo "Usage: roku-package-script [PATH TO APPLICATION]" | |
else | |
PKG_UPLOAD_PATH=$1 | |
echo "Enter the IP address of the Roku device: " | |
read DEVICE_IP | |
echo "Enter the name of the application: " | |
read APP_NAME | |
echo "Enter the signing password for the Roku devie: " | |
read DEVICE_PASS | |
PLUGIN_INSTALL="http://$DEVICE_IP/plugin_install" | |
PLUGIN_PACKAGE="http://$DEVICE_IP/plugin_package" | |
# First delete any existing application. | |
curl -silent -0 -F "archive= " -F "mysubmit=Delete" $PLUGIN_INSTALL > /dev/null | |
# Post the zip file to the Roku device. | |
curl -silent -0 -F "archive=@$PKG_UPLOAD_PATH" -F "mysubmit=true" $PLUGIN_INSTALL > /dev/null | |
# Sign the application with the app name and device password. | |
TIME=$(date +%s%M) | |
curl -silent -0 -F "app_name=$APP_NAME" -F "passwd=$DEVICE_PASS" -F "mysubmit=Package" -F "pkg_time=$(date +%s%M)" $PLUGIN_PACKAGE > /dev/null | |
# Find the name of the package using grep. | |
PKG_NAME=$(curl $PLUGIN_PACKAGE | grep -o 'pkgs\/\/\w*.pkg') | |
PKG_NAME=${PKG_NAME:6} | |
# Download the package. | |
wget -q "$PLUGIN_PACKAGE/$PKG_NAME" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment