wmbusmeters/install.sh

66 wiersze
1.3 KiB
Bash
Czysty Zwykły widok Historia

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 /
Options:
--no-adduser Do not add wmbusmeters user
"
2019-02-23 17:30:16 +00:00
exit 0
fi
if [ ! "$(basename "$1")" = "wmbusmeters" ]
2019-02-23 17:30:16 +00:00
then
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
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
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"
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 $?
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 $?
2023-06-05 09:44:28 +00:00
ROOT=$ROOT /bin/sh ./scripts/install_default_configuration.sh || exit $?
2023-06-05 09:44:28 +00:00
ROOT=$ROOT /bin/sh ./scripts/install_systemd_service.sh || exit $?
2023-06-05 09:44:28 +00:00
ROOT=$ROOT /bin/sh ./scripts/add_myself_to_dialout.sh || exit $?
echo
echo "wmbusmeters sucessfully installed."