Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 55106c1

Browse files
committed
Fixed install/remove of influxdb on non-systemd Debian/Ubuntu systems
For more rationale, please see similar PR on telegraf: influxdata/telegraf#2360
1 parent 2fe8ed3 commit 55106c1

File tree

5 files changed

+64
-54
lines changed

5 files changed

+64
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [#7877](https://github.com/influxdata/influxdb/issues/7877): Fix mapping of types when the measurement uses a regex
1313
- [#7888](https://github.com/influxdata/influxdb/pull/7888): Expand query dimensions from the subquery.
1414
- [#7910](https://github.com/influxdata/influxdb/issues/7910): Fix EvalType when a parenthesis expression is used.
15-
15+
- [#7933](https://github.com/influxdata/influxdb/pull/7933): Fixed install/remove of influxdb on non-systemd Debian/Ubuntu systems
1616

1717
## v1.2.0 [2017-01-24]
1818

package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if [ -z "$FPM" ]; then
6767
FPM=`which fpm`
6868
fi
6969

70-
GO_VERSION="go1.4.3"
70+
GO_VERSION="go1.7.5"
7171
GOPATH_INSTALL=
7272
BINS=(
7373
influxd

scripts/post-install.sh

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ function install_chkconfig {
2424
chkconfig --add influxdb
2525
}
2626

27-
id influxdb &>/dev/null
28-
if [[ $? -ne 0 ]]; then
27+
if ! id influxdb &>/dev/null; then
2928
useradd --system -U -M influxdb -s /bin/false -d $DATA_DIR
3029
fi
3130

@@ -45,29 +44,42 @@ fi
4544
# Distribution-specific logic
4645
if [[ -f /etc/redhat-release ]]; then
4746
# RHEL-variant logic
48-
which systemctl &>/dev/null
49-
if [[ $? -eq 0 ]]; then
50-
install_systemd
47+
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
48+
install_systemd
5149
else
52-
# Assuming sysv
53-
install_init
54-
install_chkconfig
50+
# Assuming SysVinit
51+
install_init
52+
# Run update-rc.d or fallback to chkconfig if not available
53+
if which update-rc.d >/dev/null; then
54+
install_update_rcd
55+
else
56+
install_chkconfig
57+
fi
5558
fi
5659
elif [[ -f /etc/debian_version ]]; then
5760
# Debian/Ubuntu logic
58-
which systemctl &>/dev/null
59-
if [[ $? -eq 0 ]]; then
60-
install_systemd
61+
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
62+
install_systemd
6163
else
62-
# Assuming sysv
63-
install_init
64-
install_update_rcd
64+
# Assuming SysVinit
65+
install_init
66+
# Run update-rc.d or fallback to chkconfig if not available
67+
if which update-rc.d >/dev/null; then
68+
install_update_rcd
69+
else
70+
install_chkconfig
71+
fi
6572
fi
6673
elif [[ -f /etc/os-release ]]; then
6774
source /etc/os-release
6875
if [[ $ID = "amzn" ]]; then
69-
# Amazon Linux logic
70-
install_init
71-
install_chkconfig
76+
# Amazon Linux logic
77+
install_init
78+
# Run update-rc.d or fallback to chkconfig if not available
79+
if which update-rc.d >/dev/null; then
80+
install_update_rcd
81+
else
82+
install_chkconfig
83+
fi
7284
fi
7385
fi

scripts/post-uninstall.sh

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,37 @@ function disable_chkconfig {
1818
if [[ -f /etc/redhat-release ]]; then
1919
# RHEL-variant logic
2020
if [[ "$1" = "0" ]]; then
21-
# InfluxDB is no longer installed, remove from init system
22-
rm -f /etc/default/influxdb
23-
24-
which systemctl &>/dev/null
25-
if [[ $? -eq 0 ]]; then
26-
disable_systemd
27-
else
28-
# Assuming sysv
29-
disable_chkconfig
30-
fi
21+
# InfluxDB is no longer installed, remove from init system
22+
rm -f /etc/default/influxdb
23+
24+
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
25+
disable_systemd
26+
else
27+
# Assuming sysv
28+
disable_chkconfig
29+
fi
3130
fi
32-
elif [[ -f /etc/lsb-release ]]; then
31+
elif [[ -f /etc/debian_version ]]; then
3332
# Debian/Ubuntu logic
3433
if [[ "$1" != "upgrade" ]]; then
35-
# Remove/purge
36-
rm -f /etc/default/influxdb
37-
38-
which systemctl &>/dev/null
39-
if [[ $? -eq 0 ]]; then
40-
disable_systemd
41-
else
42-
# Assuming sysv
43-
disable_update_rcd
44-
fi
34+
# Remove/purge
35+
rm -f /etc/default/influxdb
36+
37+
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
38+
disable_systemd
39+
else
40+
# Assuming sysv
41+
disable_update_rcd
42+
fi
4543
fi
4644
elif [[ -f /etc/os-release ]]; then
4745
source /etc/os-release
4846
if [[ $ID = "amzn" ]]; then
49-
# Amazon Linux logic
50-
if [[ "$1" = "0" ]]; then
51-
# InfluxDB is no longer installed, remove from init system
52-
rm -f /etc/default/influxdb
53-
disable_chkconfig
54-
fi
47+
# Amazon Linux logic
48+
if [[ "$1" = "0" ]]; then
49+
# InfluxDB is no longer installed, remove from init system
50+
rm -f /etc/default/influxdb
51+
disable_chkconfig
52+
fi
5553
fi
5654
fi

scripts/pre-install.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
if [[ -d /etc/opt/influxdb ]]; then
44
# Legacy configuration found
55
if [[ ! -d /etc/influxdb ]]; then
6-
# New configuration does not exist, move legacy configuration to new location
7-
echo -e "Please note, InfluxDB's configuration is now located at '/etc/influxdb' (previously '/etc/opt/influxdb')."
8-
mv -vn /etc/opt/influxdb /etc/influxdb
6+
# New configuration does not exist, move legacy configuration to new location
7+
echo -e "Please note, InfluxDB's configuration is now located at '/etc/influxdb' (previously '/etc/opt/influxdb')."
8+
mv -vn /etc/opt/influxdb /etc/influxdb
99

10-
if [[ -f /etc/influxdb/influxdb.conf ]]; then
11-
backup_name="influxdb.conf.$(date +%s).backup"
12-
echo "A backup of your current configuration can be found at: /etc/influxdb/$backup_name"
13-
cp -a /etc/influxdb/influxdb.conf /etc/influxdb/$backup_name
14-
fi
10+
if [[ -f /etc/influxdb/influxdb.conf ]]; then
11+
backup_name="influxdb.conf.$(date +%s).backup"
12+
echo "A backup of your current configuration can be found at: /etc/influxdb/${backup_name}"
13+
cp -a "/etc/influxdb/influxdb.conf" "/etc/influxdb/${backup_name}"
14+
fi
1515
fi
1616
fi

0 commit comments

Comments
 (0)