implemented basic structure and check()
This commit is contained in:
@@ -1,3 +1,89 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "unimplemented"
|
check(){
|
||||||
|
if command -v rsync &>/dev/null
|
||||||
|
then
|
||||||
|
echo "rsync is installed. Check passed. Bye."
|
||||||
|
exit 0;
|
||||||
|
else
|
||||||
|
echo "Please install rsync."
|
||||||
|
while [[ -z "$HAD_BEST_SUCCESS" ]]; do
|
||||||
|
read -p "Install now? [y/N] " QUESTION
|
||||||
|
if [[ -z "$QUESTION" ]] || [[ "$QUESTION" = "n" ]] || [[ "$QUESTION" = "N" ]]; then
|
||||||
|
echo "Alright, bye."
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
if [[ "$QUESTION" = "y" ]] || [[ "$QUESTION" = "Y" ]]; then
|
||||||
|
HAD_BEST_SUCCESS="true"
|
||||||
|
echo "Trying to install rsync..."
|
||||||
|
if command -v apt &>/dev/null
|
||||||
|
then
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install rsync -y
|
||||||
|
echo "Attempted to install rsync. Please execute the check again. Bye."
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v dnf &>/dev/null
|
||||||
|
then
|
||||||
|
sudo dnf update
|
||||||
|
sudo dnf install rsync -y
|
||||||
|
echo "Attempted to install rsync. Please execute the check again. Bye."
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v pacman &>/dev/null
|
||||||
|
then
|
||||||
|
sudo pacman -S rsync
|
||||||
|
echo "Attempted to install rsync. Please execute the check again. Bye."
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
backup(){
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
transfer(){
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
show_help(){
|
||||||
|
echo "-- HELP --"
|
||||||
|
echo " -y | Answer all questions with yes"
|
||||||
|
echo " -s SOURCE | Source path (e.g. /srv/fileshare/main/)"
|
||||||
|
echo " -d DESTINATION | Destination path (e.g. using ssh)"
|
||||||
|
echo " -b | Transfer as backup"
|
||||||
|
echo " -e | encrypt destination using a key"
|
||||||
|
echo " -h | Show this help text"
|
||||||
|
echo " -v | Get Version Info"
|
||||||
|
echo " -c | Check the usability of this tool"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":s:d:Bvhyc" opt; do
|
||||||
|
case $opt in
|
||||||
|
s) SOURCE="$OPTARG";;
|
||||||
|
d) DESTINATION="$OPTARG";;
|
||||||
|
v) exit 0 ;;
|
||||||
|
c) check ;;
|
||||||
|
e) ENCRYPT="1" ;;
|
||||||
|
b) backup ;;
|
||||||
|
h) show_help ;;
|
||||||
|
y) ALWAYS_YES="1" ;;
|
||||||
|
\?) echo "Unknown option: -$OPTARG" >&2; exit 1 ;;
|
||||||
|
:) echo "Option -$OPTARG needs an argument" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
transfer
|
||||||
|
|
||||||
|
echo "Nothing to do."
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user