diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-24 10:00:33 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-24 10:00:33 +0900 |
| commit | eb1c33fdc2c3b2ac23b3ac62f59eaa65aa51792b (patch) | |
| tree | ccf988e5440966a20d80fa65c3b293724d50c5c3 /ar/.local/bin/mounter | |
| parent | 05a1b9770b31b616ee4744cc65156d4c60c8bee3 (diff) | |
modified shell/aliasrc, modified bin/mounter, modified bin/unmounter
Diffstat (limited to 'ar/.local/bin/mounter')
| -rwxr-xr-x | ar/.local/bin/mounter | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ar/.local/bin/mounter b/ar/.local/bin/mounter index f7a3455..b69dac8 100755 --- a/ar/.local/bin/mounter +++ b/ar/.local/bin/mounter @@ -37,6 +37,8 @@ attemptmount() { fi } +notify-send -t 10000 "🔎 Searching drives to mount..." + # Check for phones. phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")" mountedphones="$(grep "simple-mtpfs" /etc/mtab)" @@ -82,34 +84,45 @@ done | filter)" normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter)" # Get all available IP addresses with open Samba shares in the wlan0 subnet, excluding eth0 IP -smbips="$(sudo arp-scan --interface=wlan0 --localnet | grep -vEi '(EFM Networks|locally administered|DUP:)' | awk '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/{print $1}')" +smbips="$(sudo arp-scan --interface=eth0 --interface=wlan0 --localnet | grep -vEi '(EFM Networks|DUP:)' | awk '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/{print $1}')" # Get currently mounted CIFS shares mountedsmbs="$(grep 'cifs' /etc/mtab)" for smbip in $smbips; do - smb=$( + win=$( smbclient -L "$smbip" -U% -A /dev/stdin <<EOF 2>/dev/null | awk '/Disk/ {print $1}' | grep -vEi '(ADMIN|\w)\$' username=$(whoami) +password=$(pass show default/windows) +EOF + ) + mac=$( + smbclient -L "$smbip" -U% -A /dev/stdin <<EOF 2>/dev/null | awk '/Disk/ {print $1}' | grep -vEi '(ADMIN|\w)\$|Macintosh' +username=$(whoami) password=$(pass show default/default) EOF ) - win=$( + smb=$( smbclient -L "$smbip" -U% -A /dev/stdin <<EOF 2>/dev/null | awk '/Disk/ {print $1}' | grep -vEi '(ADMIN|\w)\$' username=$(whoami) -password=$(pass show default/windows) +password=$(pass show default/default) EOF ) while IFS= read -r share; do if ! echo "$smbshares" | grep -q "$share"; then smbshares+="//$smbip/$share"$'\n' fi - done <<<"$smb" + done <<<"$win" while IFS= read -r share; do if ! echo "$smbshares" | grep -q "$share"; then smbshares+="//$smbip/$share"$'\n' fi - done <<<"$win" + done <<<"$mac" + while IFS= read -r share; do + if ! echo "$smbshares" | grep -q "$share"; then + smbshares+="//$smbip/$share"$'\n' + fi + done <<<"$smb" done smbshares="$(echo "$smbshares" | sed '/^$/d')" |
