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 #5146

Merged
merged 1 commit into from
Apr 19, 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
6 changes: 6 additions & 0 deletions etc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

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

for f in CONFIGURATION_FILES:
Expand Down
18 changes: 11 additions & 7 deletions etc/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ if [[ $? -ne 0 ]]; then
useradd --system -U -M chronograf -s /bin/false -d $DATA_DIR
fi

test -d $LOG_DIR || mkdir -p $DATA_DIR
test -d $DATA_DIR || mkdir -p $DATA_DIR
chown -R -L chronograf:chronograf $LOG_DIR
chown -R -L chronograf:chronograf $DATA_DIR
chmod 755 $LOG_DIR
chmod 755 $DATA_DIR

# Remove legacy symlink, if it exists
if [[ -L /etc/init.d/chronograf ]]; then
rm -f /etc/init.d/chronograf
Expand All @@ -63,6 +56,17 @@ if [[ -f /etc/redhat-release ]]; then
fi
elif [[ -f /etc/debian_version ]]; then
# Debian/Ubuntu logic

# 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.
test -d $LOG_DIR || mkdir -p $DATA_DIR
test -d $DATA_DIR || mkdir -p $DATA_DIR
chown -R -L chronograf:chronograf $LOG_DIR
chown -R -L chronograf:chronograf $DATA_DIR
chmod 755 $LOG_DIR
chmod 755 $DATA_DIR

which systemctl &>/dev/null
if [[ $? -eq 0 ]]; then
install_systemd
Expand Down