Skip to content

Instantly share code, notes, and snippets.

@alexrup
Created August 13, 2013 01:28
Show Gist options
  • Save alexrup/6217027 to your computer and use it in GitHub Desktop.
Save alexrup/6217027 to your computer and use it in GitHub Desktop.
Bash script to package roku applications.
#!/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