* Better promps and https in weather-fetch
This commit is contained in:
parent
5f4ad1f388
commit
0f392dec09
23
usm
23
usm
@ -1,11 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
mntpnt="/mnt"
|
mntpnt="/media"
|
||||||
|
|
||||||
# pick out the drive but not sda because thats the main drive
|
# pick out the drive but not sda because thats the main drive
|
||||||
choice=`lsblk -lp | \
|
choice=`lsblk -lp | \
|
||||||
grep -e 'part $' -e "part /mnt/*"| \
|
grep -e 'part $' -e "part /mnt/*"| \
|
||||||
awk '{print $1, $4}' | \
|
awk '{print $1, $4}' | \
|
||||||
dmenu -i -p 'Drive to (un)mount'`
|
dmenu -i -l 10 -p 'Drive to (un)mount'`
|
||||||
|
|
||||||
|
# Ignore empty choices and back out
|
||||||
if [ -z "$choice" ]; then exit; fi
|
if [ -z "$choice" ]; then exit; fi
|
||||||
|
|
||||||
dev=`echo $choice | awk '{print $1}'`
|
dev=`echo $choice | awk '{print $1}'`
|
||||||
@ -13,19 +15,20 @@ name="`basename $dev`"
|
|||||||
if [ -z "$dev" ]; then exit; fi
|
if [ -z "$dev" ]; then exit; fi
|
||||||
|
|
||||||
# Check if it's already mounted / something was even picked
|
# Check if it's already mounted / something was even picked
|
||||||
if grep -qs "$dev" /proc/mounts;
|
if grep -qs "$dev" /proc/mounts; then
|
||||||
then
|
echo "Unmounting mounted device $dev"
|
||||||
# unmount the drive
|
# unmount the drive
|
||||||
umount "$HOME/.mounts/$name"
|
umount "$mntpnt/$name"
|
||||||
rm -d "$HOME/.mounts/$name"
|
rm -d "$mntpnt/$name"
|
||||||
# check if we still need the .mounts directory or nah
|
|
||||||
if [ "`ls ~/.mounts/`" ]
|
# Cleanup the old mount points directory
|
||||||
then
|
if [ "`ls $mntpnt`" ]; then
|
||||||
rm -d ~/.mounts/
|
rm -d "$mntpnt"
|
||||||
fi
|
fi
|
||||||
umount $dev
|
umount $dev
|
||||||
rm -d "$mntpnt/$name"
|
rm -d "$mntpnt/$name"
|
||||||
else
|
else
|
||||||
|
echo "Mounting unmounted device $dev"
|
||||||
mkdir -p "$mntpnt/$name"
|
mkdir -p "$mntpnt/$name"
|
||||||
mount "$dev" "$mntpnt/$name"
|
mount "$dev" "$mntpnt/$name"
|
||||||
fi
|
fi
|
||||||
|
@ -38,7 +38,7 @@ class Report:
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
response = requests.get('http://wttr.in/?format=j1')
|
response = requests.get('https://wttr.in/?format=j1')
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user