aboutsummaryrefslogblamecommitdiff
path: root/bin/executable_wd-umount
blob: 08e55ebda336d5a846635c02fc697275de548942 (plain) (tree)
1
2
3
4
5
6
7
8
9

         


                           
                                       

          
                                                    
                                                                               

                                                        


                                                                                                


                                                                                                   





                           
#!/bin/sh

case `uname` in
    OpenBSD)
        doas umount /mnt/wd
        doas bioctl -d 79665ba14a5187ba
        ;;
    Linux)
        if zpool list wd-pass > /dev/null 2>&1; then
            if mount -l | grep -E '^/var/lib/mpd/music ' > /dev/null 2>&1; then
                sudo umount --lazy -f /var/lib/mpd/music
            fi
            if mount -l | grep -E '^systemd.* on /var/lib/mpd/playlists ' > /dev/null 2>&1; then
                sudo umount --lazy -f /var/lib/mpd/playlists
            fi
            mount -l -t zfs | IFS=' on ' awk '{ print $1 }' | sudo xargs -I '{}' zfs umount -u '{}'
            sudo zpool export wd-pass
        fi
        ;;
    *)
        echo "Unknown host"
        exit 1
        ;;
esac