Skip to content

Commit

Permalink
fix(package): make rpm verify pass after installation
Browse files Browse the repository at this point in the history
  • Loading branch information
affo committed Apr 30, 2019
1 parent 8c47199 commit 83b1f48
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
8 changes: 7 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

# Packaging variables
PACKAGE_NAME = "influxdb"
USER = "influxdb"
GROUP = "influxdb"
INSTALL_ROOT_DIR = "/usr/bin"
LOG_DIR = "/var/log/influxdb"
DATA_DIR = "/var/lib/influxdb"
Expand Down Expand Up @@ -63,6 +65,8 @@
--directories {} \
--directories {} \
--directories {} \
--rpm-attr 755,{},{}:{} \
--rpm-attr 755,{},{}:{} \
--description \"{}\"".format(
VENDOR,
PACKAGE_URL,
Expand All @@ -74,6 +78,8 @@
LOG_DIR,
DATA_DIR,
MAN_DIR,
USER, GROUP, LOG_DIR,
USER, GROUP, DATA_DIR,
DESCRIPTION)

for f in CONFIGURATION_FILES:
Expand Down Expand Up @@ -168,7 +174,7 @@ def go_get(branch, update=False, no_uncommitted=False):
run(get_command)
logging.info("Retrieving dependencies with `dep`...")
sys.stdout.flush()
run("{}/bin/dep ensure -v -vendor-only".format(os.environ.get("GOPATH")))
run("{}/bin/dep ensure -v -vendor-only".format(os.environ.get("GOPATH", os.path.expanduser("~/go"))))
return True

def run_tests(race, parallel, timeout, no_vet, junit=False):
Expand Down
16 changes: 8 additions & 8 deletions scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ function install_chkconfig {
chkconfig --add influxdb
}

id influxdb &>/dev/null
if [[ $? -ne 0 ]]; then
useradd --system -U -M influxdb -s /bin/false -d $DATA_DIR
fi

chown -R -L influxdb:influxdb $DATA_DIR
chown -R -L influxdb:influxdb $LOG_DIR

# Add defaults file, if it doesn't exist
if [[ ! -f /etc/default/influxdb ]]; then
touch /etc/default/influxdb
Expand All @@ -53,6 +45,14 @@ if [[ -f /etc/redhat-release ]]; then
install_chkconfig
fi
elif [[ -f /etc/debian_version ]]; then
# Ownership for RH-based platforms is set in build.py via the `rmp-attr` option.
# We perform ownership change only for Debian-based systems.
# Moving these lines out of this if statement would make `rmp -V` fail after installation.
chown -R -L influxdb:influxdb $LOG_DIR
chown -R -L influxdb:influxdb $DATA_DIR
chmod 755 $LOG_DIR
chmod 755 $DATA_DIR

# Debian/Ubuntu logic
if command -v systemctl &>/dev/null; then
install_systemd
Expand Down
6 changes: 6 additions & 0 deletions scripts/pre-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

DATA_DIR=/var/lib/influxdb

if ! id influxdb &>/dev/null; then
useradd --system -U -M influxdb -s /bin/false -d $DATA_DIR
fi

if [[ -d /etc/opt/influxdb ]]; then
# Legacy configuration found
if [[ ! -d /etc/influxdb ]]; then
Expand Down

0 comments on commit 83b1f48

Please sign in to comment.