Skip to content

Instantly share code, notes, and snippets.

@exelix11
Created August 9, 2019 10:47
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 exelix11/8dcae1b279b769b28fbd45423d995260 to your computer and use it in GitHub Desktop.
Save exelix11/8dcae1b279b769b28fbd45423d995260 to your computer and use it in GitHub Desktop.
RemoteInstall script for NXThemes Installer on Linux
#!/bin/bash
#If used on WSL mind the line endings, only use LF (unix-style)
echo "RemoteInstall for NXThemeInstaller by exelix"
echo "Tested on Installer 2.0.1, may break for future versions (hopefully not)"
IPADDR=$1
FILENAME=$2
if [ -z "$FILENAME" ] || [ -z "$IPADDR" ]
then
echo "Usage $0 [IpAddress] [fileName]"
echo "only nxtheme and szs files are supported"
exit
fi
if [ ! -f "$FILENAME" ]; then
echo "$FILENAME not found!"
exit
fi
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
printf "theme\x0\x0\x0" > __tmp__theme
#TODO: detect endianness and write proper size
printf "0: %.8x" $FILESIZE | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >>__tmp__theme
# for Big Endian: printf "0: %.8x" $FILESIZE | xxd -r -g0 >>__tmp__theme
cat $FILENAME >> __tmp__theme
echo "Response from $IPADDR: "
cat __tmp__theme | nc $IPADDR 5000
rm __tmp__theme
echo "."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment