Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #/#/ Define any tools needed here seperated only by a "\:space:"\
- needed_tool=' yad archivemount '
- #//* Begin System Tool Search
- require_tools ()
- {
- local NOT_AVAIL=""
- for TOOL in $needed_tool; do
- if [ "`which $TOOL`" 2> /dev/null == "" ]; then
- NOT_AVAIL="$NOT_AVAIL $TOOL";
- fi
- done
- if [[ "$NOT_AVAIL" != "" ]]; then
- echo "ERROR: The following required tool(s) cannot be found: $NOT_AVAIL"
- exit 3
- fi
- }
- # Check file system tools before we start
- require_tools || exit 1
- # VARIABLES
- THIS_DIR=$PWD/TMP_ARCH
- MK_DIR=$(mkdir $THIS_DIR)
- FILE=./backup.$(date | sed -e "s/\ /./g").tar
- DESTIN="$(yad --title "Choose Direcotory To Backup" --file-selection --directory)"
- # PREPERATION
- touch "$FILE"
- $MK_DIR
- archivemount "$FILE" "$THIS_DIR"
- # ADDING FILE TO ARCHIVE
- cp -r -v "$DESTIN" "$THIS_DIR"
- echo -e "To continue press [e]nter: "
- read NULL
- # UNMOUNT
- fusermount -u $THIS_DIR
- # CLEANUP
- rm -R $THIS_DIR
- rm "$FILE".orig
- # FINISH
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement