Added optional statistics for installer

This commit is contained in:
deajan 2016-03-25 22:51:26 +01:00
parent 6d410409a3
commit a7e8487df3
3 changed files with 33 additions and 3 deletions

View File

@ -11,6 +11,7 @@ CHANGELOG
README: FreeBSD execution needs mailer (not found), sudo missing, bash needed, sed missing (see if StripQuotes mandatory)
! XX Mar 2016: obackup v2.0 released
- Added optional statistics for installer
- Added an option to ignore knownhosts for ssh connections (use with caution, this can lead to a security issue)
- Improved mail fallback
- More logging enhancements

View File

@ -3,6 +3,8 @@
## Merges ofunctions.sh and n_osync.sh into osync.sh
PROGRAM=obackup
VERSION=$(grep "PROGRAM_VERSION=" n_$PROGRAM.sh)
VERSION=${VERSION#*=}
FUNC_PATH=/home/git/common
PARANOIA_DEBUG_LINE="__WITH_PARANOIA_DEBUG"
@ -36,7 +38,8 @@ function CleanDebug {
}
function CopyCommons {
sed "s/\[prgname\]/$PROGRAM/g" /home/git/common/common_install.sh > ../install.sh
sed "s/\[prgname\]/$PROGRAM/g" /home/git/common/common_install.sh > ../tmp_install.sh
sed "s/\[version\]/$VERSION/g" ../tmp_install.sh > ../install.sh
sed "s/\[prgname\]/$PROGRAM/g" /home/git/common/common_batch.sh > ../$PROGRAM-batch.sh
chmod +x ../install.sh
chmod +x ../obackup-batch.sh
@ -46,4 +49,5 @@ Unexpand
Merge
CleanDebug
rm -f tmp_$PROGRAM.sh
rm -f ../tmp_install.sh
CopyCommons

View File

@ -1,9 +1,10 @@
#!/usr/bin/env bash
PROGRAM=obackup
PROGRAM_VERSION=2.0-pre
PROGRAM_BINARY=$PROGRAM".sh"
PROGRAM_BATCH=$PROGRAM"-batch.sh"
SCRIPT_BUILD=2016032202
SCRIPT_BUILD=2016032501
## osync / obackup daemon install script
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8 & 10
@ -32,7 +33,6 @@ case $local_os_var in
;;
esac
if [ "$(whoami)" != "$USER" ]; then
echo "Must be run as $USER."
exit 1
@ -104,3 +104,28 @@ if [ -f "./osync-srv" ]; then
echo "Created osync-srv service in [$SERVICE_DIR]."
fi
fi
function Statistics {
local link="http://instcount.netpower.fr?program=$PROGRAM&version=$PROGRAM_VERSION"
if type wget > /dev/null; then
wget $link > /dev/null 2>&1
elif type curl > /dev/null; then
curl $link > /dev/null 2>&1
else
echo "Neiter wget nor curl installed. Cannot run statistics. Use link below please."
fi
}
echo "$PROGRAM installed. Use with $BIN_DIR/$PROGRAM"
echo ""
echo "In order to make install statistics, the script would like to connect to http://instcount.netpower.fr?program=$PROGRAM&version=$PROGRAM_VERSION"
read -r -p "No data except those in the url will be send. Allow [Y/n]" response
case $response in
[nN])
exit
;;
*)
Statistics
;;
esac