Skip to content

Commit

Permalink
🍰 Initial commit 🍰
Browse files Browse the repository at this point in the history
Based on information in S01config in steamlink-sdk

https://github.com/ValveSoftware/steamlink-sdk/blob/master/rootfs/etc/init.d/startup/S01config

Icon is from https://icon-icons.com/icon/pendrive-usb/78535
by Juliia Osadcha, Free for commercial use, can NOT be sold.
Attribution not required but appreciated.
  • Loading branch information
clach04 committed Jun 7, 2019
0 parents commit 3f33c37
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# tar -c -f archive.tar --owner=0 --group=0 .

name=usbmounttoggle
tar -zcvf $name.tgz --owner=0 --group=0 $name

echo ''
echo now place $name.tgz on to USB drive in directory:
echo ''
echo ' \steamlink\apps # Windows'
echo ' /steamlink/apps # Linux/Unix'
Binary file added usbmounttoggle/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions usbmounttoggle/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# NOTE this files needs the executable bit set
# toc.txt expects a binary for "run" argument, "run=sh run.sh" does NOT work

# Simple mount/unmount toggle script
# Simplistic, only mounts first partition, not like https://github.com/ValveSoftware/steamlink-sdk/blob/master/rootfs/etc/init.d/startup/S01config

MOUNT_DISK=/mnt/disk
device=/dev/block/sda1

do_mount()
{
mount ${device} ${MOUNT_DISK}
}

do_umount()
{
umount ${MOUNT_DISK}
}

if [ ! -d ${MOUNT_DISK} ]
then
mkdir -p ${MOUNT_DISK}
fi

#df ${MOUNT_DISK} | grep ${MOUNT_DISK}\$ && do_umount

# output never seen on Steam Link, so no need to 2>/dev/null
df ${MOUNT_DISK} | grep ${MOUNT_DISK}\$
status=$?
if [ $status -eq 0 ]
then
do_umount
else
do_mount
fi
# TODO look at switching icons/toc.txt around to display a different icon so mount status can be seen easily
3 changes: 3 additions & 0 deletions usbmounttoggle/toc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name=USBMountToggle
icon=icon.png
run=run.sh

0 comments on commit 3f33c37

Please sign in to comment.