-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstall_scripts.sh
executable file
·93 lines (72 loc) · 2.63 KB
/
install_scripts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env bash
SCRIPTS=$(realpath $(dirname "$0"))/scripts
# does a "scripts" folder exist in this directory?
if [ -d "$SCRIPTS" ] ; then
# the winner by default is
WINNER="$HOME/.local/bin"
# does the winner exist?
if [ ! -d "$WINNER" ] ; then
# check the search path
for CANDIDATE in ${PATH//:/ }; do
if [[ $CANDIDATE == $HOME* ]] ; then
WINNER="$CANDIDATE"
break
fi
done
fi
# make sure the winner exists
mkdir -p "$WINNER"
# copy executables into place
cp -av "$SCRIPTS"/* "$WINNER"
else
echo "Skipped: $SCRIPTS not found in $PWD"
fi
# check apt-installable dependencies
for D in curl jq wget ; do
if [ -z "$(which "$D")" ] ; then
echo ""
echo "=========================================================================="
echo "IOTstackBackup depends on \"$D\" which does not seem to be installed on your"
echo "system. Please run the following command:"
echo ""
echo " sudo apt install $D"
echo ""
echo "=========================================================================="
fi
done
# check if mosquitto_pub is available
if [ -z "$(which mosquitto_pub)" ] ; then
echo ""
echo "=========================================================================="
echo "IOTstackBackup depends on \"mosquitto_pub\" which does not seem to be installed"
echo "on your system. Please run the following command:"
echo ""
echo " sudo apt install mosquitto-clients"
echo ""
echo "=========================================================================="
fi
# check if shyaml is installed
if [ -z "$(which shyaml)" ] ; then
echo ""
echo "=========================================================================="
echo "IOTstackBackup depends on \"shyaml\" which does not seem to be installed on your"
echo "system. On Bullseye or earlier systems, please run:"
echo ""
echo " pip3 install -U shyaml"
echo ""
echo "On Bookworm systems, run:"
echo ""
echo " pip3 install -U --break-system-packages shyaml"
echo "=========================================================================="
fi
# check for rclone
if [ -z "$(which rclone)" ] ; then
echo ""
echo "=========================================================================="
echo "If you intend to use RCLONE with IOTstackBackup, please note that it is not"
echo "installed on your system. Please run the following command:"
echo ""
echo " curl https://rclone.org/install.sh | sudo bash"
echo ""
echo "=========================================================================="
fi