2019-02-23 17:30:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-04-25 20:29:15 +00:00
|
|
|
if [ "$1" == "" ] || [ "$1" == "-h" ]
|
2019-02-23 17:30:16 +00:00
|
|
|
then
|
2019-04-26 14:58:47 +00:00
|
|
|
echo "Usage: install.sh [binary] [root] [OPTIONS]
|
2019-04-25 20:29:15 +00:00
|
|
|
Example: install.sh build/wmbusmeters /
|
2019-05-21 12:19:54 +00:00
|
|
|
|
2020-10-26 11:28:23 +00:00
|
|
|
Options:
|
|
|
|
--no-adduser Do not add wmbusmeters user
|
|
|
|
"
|
2019-02-23 17:30:16 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-04-26 16:32:36 +00:00
|
|
|
if [ ! "$(basename "$1")" = "wmbusmeters" ]
|
2019-02-23 17:30:16 +00:00
|
|
|
then
|
2020-10-25 15:00:06 +00:00
|
|
|
echo "Oups, please only try to install wmbusmeters using this script."
|
2019-02-23 17:30:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -x "$1" ]
|
|
|
|
then
|
2020-10-25 15:00:06 +00:00
|
|
|
echo "This is not an executable."
|
2019-02-23 17:30:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-02-23 18:49:30 +00:00
|
|
|
if [ ! -d "$2" ]
|
|
|
|
then
|
2020-10-25 15:00:06 +00:00
|
|
|
echo "Oups, please supply a valid root directory."
|
2019-02-23 18:49:30 +00:00
|
|
|
exit 1
|
2019-02-23 17:30:16 +00:00
|
|
|
fi
|
|
|
|
|
2019-04-26 14:58:47 +00:00
|
|
|
SRC=$1
|
2019-02-23 18:49:30 +00:00
|
|
|
ROOT="${2%/}"
|
2019-04-25 20:29:15 +00:00
|
|
|
ADDUSER=true
|
|
|
|
|
|
|
|
while [ $# -ne 0 ]
|
|
|
|
do
|
|
|
|
ARG="$1"
|
2019-05-21 12:19:54 +00:00
|
|
|
shift
|
2019-04-25 20:29:15 +00:00
|
|
|
case "$ARG" in
|
|
|
|
--no-adduser)
|
|
|
|
ADDUSER=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
SRC=$SRC ROOT=$ROOT /bin/sh ./scripts/install_binaries.sh || exit $?
|
2019-02-24 08:58:31 +00:00
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/install_manpage.sh || exit $?
|
2019-04-25 20:29:15 +00:00
|
|
|
|
2019-02-23 18:49:30 +00:00
|
|
|
if [ "$ADDUSER" = "true" ]
|
2019-02-23 17:30:16 +00:00
|
|
|
then
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/add_wmbusmeters_user.sh || exit $?
|
2019-02-23 17:30:16 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/prepare_logfiles.sh || exit $?
|
2019-02-24 08:58:31 +00:00
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/install_default_configuration.sh || exit $?
|
2020-01-19 22:21:17 +00:00
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/install_systemd_service.sh || exit $?
|
2021-10-16 18:20:22 +00:00
|
|
|
|
2023-06-05 09:44:28 +00:00
|
|
|
ROOT=$ROOT /bin/sh ./scripts/add_myself_to_dialout.sh || exit $?
|
|
|
|
|
|
|
|
echo
|
2023-06-28 08:46:50 +00:00
|
|
|
echo "wmbusmeters sucessfully installed."
|