-
Notifications
You must be signed in to change notification settings - Fork 2
/
sdstatus.1s.sh
82 lines (63 loc) · 3.71 KB
/
sdstatus.1s.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# <bitbar.title>SD-Card-Mounter</bitbar.title>
# <bitbar.version>v0.1</bitbar.version>
# <bitbar.author>ManuGithubSteam</bitbar.author>
# <bitbar.author.github>citoki</bitbar.author.github>
# <bitbar.desc>This plugin will let you mount your SD-Card on the Xainomi Pro 15.6</bitbar.desc>
# <bitbar.image>https://i.imgur.com/vsCWLwX.png</bitbar.image>
# <bitbar.dependencies></bitbar.dependencies>
SD_ON="iVBORw0KGgoAAAANSUhEUgAAABEAAAAMCAYAAACEJVa/AAAACXBIWXMAAABpAAAAaQFxoZjYAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAFh0RVh0Q29weXJpZ2h0AENDMCBQdWJsaWMgRG9tYWluIERlZGljYXRpb24gaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvcHVibGljZG9tYWluL3plcm8vMS4wL8bjvfkAAAG7SURBVCiRndCxaxNhGMfx7/Pe6/Vyl7sYSycHCdHQCIpYDW76F4jg7uAg/g8OzhmdHPwranXTTRqHglNRWjoITSCkjXchl7eXXO51qAkVHbTP+Hvgw/P8pNO8+Rprn3P+eSOfb2yYqHXHy4dDdKVC+vUbojX+tauMd3fxGw2KyQQcB1GCUw5JtjtnkRMtthDlreA31zna3KL64D6IMPzwkah1l6C5TtbtoXyf2fEx4ihUqURhzAIRjXacPI7Juj3CjdvE2x1EO0T3WuQ/YgZvt3DX1pgbgw5DlOedBQCUfLp+6ztinXM3YmWu3z18dDkIfEcpheu6GGNYXb3EZGLQ2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3sI0i4gm10GoLm5CVVViUTCJJMpotEIAJZloWlardE0TYrFIrZt4/N5kSQJVd3/lLXVBIMBVFVlbi5FKHSMVCpNV9cJdH0Vx3HQNDemadZgk5NTCCHw+/0EAn4URUaSREOADbC0lKsldX0VgNnZrw0X6zgOpVIZgM7O41iWRSazhNfrOXiCv1U6vbBjpChsbuYbAg78An+iSqW6524EsP/Bfwv4UBebwHZdXFUAA/AdYjQDfAF6gdM/c2XgVjw+8vp3jZLjiGEgCWzUHaOuZkzTOB+PjwxVq1wGcjs14v5h5gA/ACtm73u+DeoeAAAAAElFTkSuQmCC"
function get_sd_state {
mount | grep mmcblk &> /dev/null;
mounted=$(echo $?)
# set state
if [ $mounted = 1 ]; then
state="SD-Card not mounted";
COLOR="blue"
else
state="SD-Card mounted";
COLOR="green"
fi
}
function set_program_icon {
get_sd_state;
if [[ "$state" = "" ]]; then
icon="img-sd-mount";
else
icon="img-sd-umount";
fi
}
if [ "$1" = "start" ]; then
state="working, please wait";
COLOR="yellow"
USERM=$(/bin/bash -c who | head -n1 | cut -d' ' -f1)
/usr/bin/sudo -u $USERM -i bash -c "/Users/$USERM/Virtual\ Machines.localized/Tiny.vmwarevm/sd-mount.sh &"
exit
fi
if [ "$1" = "stop" ]; then
open .
exit
fi
# set program icon to default: 'not active state'
set_program_icon;
if [ -f $HOME/Virtual\ Machines.localized/Tiny.vmwarevm/mountinprogress.file ]; then
echo "| templateImage=$SD_OFF"
echo "---"
echo "mounting, please wait | color=yellow"
echo "---"
exit
fi
if [ $mounted = 1 ]; then
echo "| templateImage=$SD_ON"
echo "---"
echo "${state} | color=$COLOR"
echo "---"
echo "Mount SD-Card | bash='$0' param1=start terminal=false refresh=true"
else
echo "| templateImage=$SD_ON"
echo "---"
echo "${state} | color=$COLOR"
echo "---"
echo "Umount in Finder | bash='$0' param1=stop terminal=false refresh=true"
fi