Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(package): make rpm verify pass after installation #13397

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
gunnaraasen marked this conversation as resolved.
Show resolved Hide resolved
# 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