Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # info: start transmission in sandbox taking .torrent files from desktop
- CONF=$HOME"/.config/transmission"
- TORR="$CONF/torrents"
- LINK=$HOME"/Desktop/sandbox"
- TEMP="/tmp/.sandbox_"$USER"_transmission_"$RANDOM
- #TEMP=$HOME"/tmp/.sandbox_"$USER"_transmission_"$RANDOM
- # is there any .torrent files in desktop?
- if ! ls ~/Desktop/*.torrent &>/dev/null; then
- zenity --error --title "Transmission sandbox" --text "No torrent files on Desktop"
- exit 1
- fi
- # trap code to delete temp dirs even on unexpected exit
- trap "{ rm -rf $TEMP $LINK; }" 0 1 2 3 5 15
- # copy torrent files to config and create temp dir
- rm -f "$TORR"/*
- cp ~/Desktop/*.torrent "$TORR"/
- rm -rf "$TEMP"
- mkdir -p -m 0700 "$TEMP"
- ln -sf "$TEMP" "$LINK"
- # start sandboxed transmission
- sandbox -i "$CONF" -t sandbox_net_t -w 500x600 -H "$TEMP" -X transmission-gtk
- # delete temp dir and file
- rm -f "$LINK"
- rm -rf "$TEMP"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement