dist/debian: use install.sh on Debian
Currently, install.sh just used for building .rpm, we have similar build script under dist/debian, sometimes it become inconsistent with install.sh. Since most of package build process are same, we should share install.sh on both .rpm and .deb package build process. Signed-off-by: Takuya ASADA <syuu@scylladb.com> Message-Id: <20190725123207.2326-1-syuu@scylladb.com>
This commit is contained in:
1
dist/debian/build_deb.sh
vendored
1
dist/debian/build_deb.sh
vendored
@@ -142,7 +142,6 @@ MUSTACHE_DIST="\"debian\": true, \"product\": \"$PRODUCT\", \"$PRODUCT\": true"
|
||||
pystache dist/debian/changelog.mustache "{ $MUSTACHE_DIST, \"version\": \"$SCYLLA_VERSION\", \"release\": \"$SCYLLA_RELEASE\", \"revision\": \"$REVISION\", \"codename\": \"$TARGET\" }" > debian/changelog
|
||||
pystache dist/debian/rules.mustache "{ $MUSTACHE_DIST }" > debian/rules
|
||||
pystache dist/debian/control.mustache "{ $MUSTACHE_DIST }" > debian/control
|
||||
pystache dist/debian/scylla-server.install.mustache "{ $MUSTACHE_DIST, \"dist\": $DIST }" > debian/$PRODUCT-server.install
|
||||
pystache dist/debian/scylla-conf.preinst.mustache "{ \"version\": \"$SCYLLA_VERSION\" }" > debian/$PRODUCT-conf.preinst
|
||||
chmod a+rx debian/rules
|
||||
|
||||
|
||||
2
dist/debian/debian/scylla-conf.install
vendored
2
dist/debian/debian/scylla-conf.install
vendored
@@ -1,2 +0,0 @@
|
||||
conf/scylla.yaml etc/scylla
|
||||
conf/cassandra-rackdc.properties etc/scylla
|
||||
@@ -1,2 +0,0 @@
|
||||
dist/common/sysctl.d/99-scylla-sched.conf /etc/sysctl.d
|
||||
dist/common/sysctl.d/99-scylla-aio.conf /etc/sysctl.d
|
||||
@@ -8,8 +8,8 @@ if [[ $KVER =~ 3\.13\.0\-([0-9]+)-generic ]]; then
|
||||
echo "kernel $KVER detected, skip running sysctl..."
|
||||
else
|
||||
# expect failures in virtualized environments
|
||||
sysctl -p/etc/sysctl.d/99-scylla-sched.conf || :
|
||||
sysctl -p/etc/sysctl.d/99-scylla-aio.conf || :
|
||||
sysctl -p/usr/lib/sysctl.d/99-scylla-sched.conf || :
|
||||
sysctl -p/usr/lib/sysctl.d/99-scylla-aio.conf || :
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
1
dist/debian/debian/scylla-server-dbg.install
vendored
1
dist/debian/debian/scylla-server-dbg.install
vendored
@@ -1 +0,0 @@
|
||||
scylla-gdb.py opt/scylladb/scripts
|
||||
39
dist/debian/rules.mustache
vendored
39
dist/debian/rules.mustache
vendored
@@ -2,41 +2,24 @@
|
||||
|
||||
export PYBUILD_DISABLE=1
|
||||
jobs := $(shell echo $$DEB_BUILD_OPTIONS | sed -r "s/.*parallel=([0-9]+).*/-j\1/")
|
||||
{{#housekeeping}}
|
||||
install_arg := --housekeeping
|
||||
{{/housekeeping}}
|
||||
{{^housekeeping}}
|
||||
install_arg :=
|
||||
{{/housekeeping}}
|
||||
|
||||
override_dh_auto_configure:
|
||||
|
||||
override_dh_auto_build:
|
||||
|
||||
override_dh_auto_clean:
|
||||
|
||||
_override_dh_auto_install:
|
||||
override_dh_auto_install:
|
||||
dh_auto_install
|
||||
install -d $(CURDIR)/debian/{{product}}-server/usr/bin
|
||||
ln -sf /opt/scylladb/bin/scylla $(CURDIR)/debian/{{product}}-server/usr/bin/scylla
|
||||
ln -sf /opt/scylladb/bin/iotune $(CURDIR)/debian/{{product}}-server/usr/bin/iotune
|
||||
ln -sf /opt/scylladb/scyllatop/scyllatop.py $(CURDIR)/debian/{{product}}-server/usr/bin/scyllatop
|
||||
install -d $(CURDIR)/debian/{{product}}-server/opt/scylladb/scyllatop
|
||||
cp -r tools/scyllatop/* $(CURDIR)/debian/{{product}}-server/opt/scylladb/scyllatop/
|
||||
install -d $(CURDIR)/debian/{{product}}-server/opt/scylladb/scripts
|
||||
cp -r dist/common/scripts/* $(CURDIR)/debian/{{product}}-server/opt/scylladb/scripts/
|
||||
PYSCRIPTS=$$(find dist/common/scripts/ -maxdepth 1 -type f -exec grep -Pls '\A\#!/usr/bin/env python3' {} +) ; \
|
||||
for i in $$PYSCRIPTS; do \
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $(CURDIR)/debian/scylla-server/opt/scylladb/scripts/ --with-python3 "$(CURDIR)/debian/{{product}}-server/opt/scylladb/python3/bin/python3" $$i ;\
|
||||
done
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $(CURDIR)/debian/{{product}}-server/opt/scylladb/scripts/ --with-python3 "$(CURDIR)/debian/{{product}}-server/opt/scylladb/python3/bin/python3" \
|
||||
seastar/scripts/perftune.py seastar/scripts/seastar-addr2line seastar/scripts/perftune.py
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $(CURDIR)/debian/{{product}}-server/opt/scylladb/scyllatop/ --with-python3 "$(CURDIR)/debian/{{product}}-server/opt/scylladb/python3/bin/python3" \
|
||||
tools/scyllatop/scyllatop.py
|
||||
install -d $(CURDIR)/debian/{{product}}-server/usr/sbin
|
||||
|
||||
SBINFILES := $(shell cd dist/common/scripts/; echo scylla_*setup node_exporter_install node_health_check scylla_ec2_check scylla_kernel_check)
|
||||
|
||||
$(addprefix $(CURDIR)/debian/{{product}}-server/usr/sbin/, $(SBINFILES)):
|
||||
ln -srf $(addprefix /opt/scylladb/scripts/, $(notdir $@)) $@
|
||||
|
||||
override_dh_auto_install: _override_dh_auto_install $(addprefix $(CURDIR)/debian/{{product}}-server/usr/sbin/, $(SBINFILES))
|
||||
./install.sh --root "$(CURDIR)/debian/{{product}}-conf" $(install_arg) --target "stable" --pkg "conf" --disttype "debian"
|
||||
./install.sh --root "$(CURDIR)/debian/{{product}}-kernel-conf" $(install_arg) --target "stable" --pkg "kernel-conf" --disttype "debian"
|
||||
./install.sh --root "$(CURDIR)/debian/{{product}}-server" $(install_arg) --target "stable" --pkg "server" --disttype "debian"
|
||||
|
||||
override_dh_installinit:
|
||||
{{#scylla}}
|
||||
|
||||
8
dist/redhat/scylla.spec.mustache
vendored
8
dist/redhat/scylla.spec.mustache
vendored
@@ -62,11 +62,11 @@ defines=()
|
||||
|
||||
%install
|
||||
{{#housekeeping}}
|
||||
./install.sh --root "$RPM_BUILD_ROOT" --housekeeping --target {{target}}
|
||||
{{/housekeeping}}
|
||||
{{^housekeeping}}
|
||||
./install.sh --root "$RPM_BUILD_ROOT" --target {{target}}
|
||||
install_arg="--housekeeping"
|
||||
{{/housekeeping}}
|
||||
./install.sh --root "$RPM_BUILD_ROOT" $install_arg --target {{target}} --pkg "conf" --disttype "redhat"
|
||||
./install.sh --root "$RPM_BUILD_ROOT" $install_arg --target {{target}} --pkg "kernel-conf" --disttype "redhat"
|
||||
./install.sh --root "$RPM_BUILD_ROOT" $install_arg --target {{target}} --pkg "server" --disttype "redhat"
|
||||
|
||||
%pre server
|
||||
getent group scylla || /usr/sbin/groupadd scylla 2> /dev/null || :
|
||||
|
||||
188
install.sh
188
install.sh
@@ -32,6 +32,8 @@ Options:
|
||||
--python3 /opt/python3 path of the python3 interpreter relative to install root (default /opt/scylladb/python3/bin/python3)
|
||||
--housekeeping enable housekeeping service
|
||||
--target centos specify target distribution
|
||||
--disttype [redhat|debian] specify type of distribution (redhat or debian)
|
||||
--pkg package specify build package (server/conf/kernel-conf)
|
||||
--help this helpful message
|
||||
EOF
|
||||
exit 1
|
||||
@@ -65,6 +67,14 @@ while [ $# -gt 0 ]; do
|
||||
python3="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--disttype")
|
||||
disttype="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--pkg")
|
||||
pkg="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--help")
|
||||
shift 1
|
||||
print_usage
|
||||
@@ -74,95 +84,127 @@ while [ $# -gt 0 ]; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "$pkg" != "server" -a "$pkg" != "conf" -a "$pkg" != "kernel-conf" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rprefix="$root/$prefix"
|
||||
retc="$root/etc"
|
||||
rusr="$root/usr"
|
||||
rdoc="$rprefix/share/doc"
|
||||
|
||||
MUSTACHE_DIST="\"redhat\": true, \"$target\": true, \"target\": \"$target\""
|
||||
is_redhat=false
|
||||
is_debian=false
|
||||
MUSTACHE_DIST="\"$target\": true, \"target\": \"$target\""
|
||||
if [ "$disttype" = "redhat" ]; then
|
||||
MUSTACHE_DIST="\"redhat\": true, $MUSTACHE_DIST"
|
||||
is_redhat=true
|
||||
sysconfdir=sysconfig
|
||||
elif [ "$disttype" = "debian" ]; then
|
||||
MUSTACHE_DIST="\"debian\": true, $MUSTACHE_DIST"
|
||||
is_debian=true
|
||||
sysconfdir=default
|
||||
else
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p build
|
||||
pystache dist/common/systemd/scylla-server.service.mustache "{ $MUSTACHE_DIST }" > build/scylla-server.service
|
||||
pystache dist/common/systemd/scylla-housekeeping-daily.service.mustache "{ $MUSTACHE_DIST }" > build/scylla-housekeeping-daily.service
|
||||
pystache dist/common/systemd/scylla-housekeeping-restart.service.mustache "{ $MUSTACHE_DIST }" > build/scylla-housekeeping-restart.service
|
||||
|
||||
|
||||
install -m755 -d "$retc/sysconfig" "$retc/security/limits.d"
|
||||
install -m755 -d "$retc/scylla.d" "$rusr/lib/sysctl.d"
|
||||
install -m644 dist/common/sysconfig/scylla-server -Dt "$retc"/sysconfig
|
||||
install -m644 dist/common/limits.d/scylla.conf -Dt "$retc"/security/limits.d
|
||||
install -m644 dist/common/scylla.d/*.conf -Dt "$retc"/scylla.d
|
||||
install -m644 dist/common/sysctl.d/*.conf -Dt "$rusr"/lib/sysctl.d
|
||||
|
||||
SYSCONFDIR="/etc/sysconfig"
|
||||
REPOFILES="'/etc/yum.repos.d/scylla*.repo'"
|
||||
|
||||
|
||||
install -d -m755 "$retc"/scylla "$rusr/lib/systemd/system" "$rusr/bin" "$rprefix/bin" "$rprefix/libexec" "$rprefix/libreloc" "$rprefix/scripts"
|
||||
install -m644 conf/scylla.yaml -Dt "$retc"/scylla
|
||||
install -m644 conf/cassandra-rackdc.properties -Dt "$retc"/scylla
|
||||
install -m644 build/*.service -Dt "$rusr"/lib/systemd/system
|
||||
install -m644 dist/common/systemd/*.service -Dt "$rusr"/lib/systemd/system
|
||||
install -m644 dist/common/systemd/*.timer -Dt "$rusr"/lib/systemd/system
|
||||
install -m755 seastar/scripts/seastar-cpu-map.sh -Dt "$rprefix"/scripts
|
||||
install -m755 seastar/dpdk/usertools/dpdk-devbind.py -Dt "$rprefix"/scripts
|
||||
install -m755 bin/* -Dt "$rprefix/bin"
|
||||
# some files in libexec are symlinks, which "install" dereferences
|
||||
# use cp -P for the symlinks instead.
|
||||
install -m755 libexec/*.bin -Dt "$rprefix/libexec"
|
||||
for f in libexec/*; do
|
||||
if [[ "$f" != *.bin ]]; then
|
||||
cp -P "$f" "$rprefix/libexec"
|
||||
if [ -z "$pkg" ] || [ "$pkg" = "conf" ]; then
|
||||
install -d -m755 "$retc"/scylla
|
||||
install -d -m755 "$retc"/scylla.d
|
||||
install -m644 conf/scylla.yaml -Dt "$retc"/scylla
|
||||
install -m644 conf/cassandra-rackdc.properties -Dt "$retc"/scylla
|
||||
# XXX: since housekeeping.cfg is mistakenly belongs to different package
|
||||
# in .rpm/.deb, we need this workaround to make package upgradable
|
||||
if $is_redhat && $housekeeping; then
|
||||
install -m644 conf/housekeeping.cfg -Dt "$retc"/scylla.d
|
||||
fi
|
||||
done
|
||||
install -m755 libreloc/* -Dt "$rprefix/libreloc"
|
||||
ln -srf "$rprefix/bin/scylla" "$rusr/bin/scylla"
|
||||
ln -srf "$rprefix/bin/iotune" "$rusr/bin/iotune"
|
||||
|
||||
if $housekeeping; then
|
||||
install -m644 conf/housekeeping.cfg -Dt "$retc"/scylla.d
|
||||
fi
|
||||
install -d -m755 "$rdoc"/scylla
|
||||
install -m644 README.md -Dt "$rdoc"/scylla/
|
||||
install -m644 README-DPDK.md -Dt "$rdoc"/scylla
|
||||
install -m644 NOTICE.txt -Dt "$rdoc"/scylla/
|
||||
install -m644 ORIGIN -Dt "$rdoc"/scylla/
|
||||
install -d -m755 -d "$rdoc"/scylla/licenses/
|
||||
install -m644 licenses/* -Dt "$rdoc"/scylla/licenses/
|
||||
install -m755 -d "$root"/var/lib/scylla/
|
||||
install -m755 -d "$root"/var/lib/scylla/data
|
||||
install -m755 -d "$root"/var/lib/scylla/commitlog
|
||||
install -m755 -d "$root"/var/lib/scylla/hints
|
||||
install -m755 -d "$root"/var/lib/scylla/view_hints
|
||||
install -m755 -d "$root"/var/lib/scylla/coredump
|
||||
install -m755 -d "$root"/var/lib/scylla-housekeeping
|
||||
install -m755 -d "$rprefix"/swagger-ui
|
||||
cp -r swagger-ui/dist "$rprefix"/swagger-ui
|
||||
install -d -m755 -d "$rprefix"/api
|
||||
cp -r api/api-doc "$rprefix"/api
|
||||
install -d -m755 -d "$rprefix"/scyllatop
|
||||
cp -r tools/scyllatop/* "$rprefix"/scyllatop
|
||||
install -d -m755 -d "$rprefix"/scripts
|
||||
cp -r dist/common/scripts/* "$rprefix"/scripts
|
||||
ln -srf "$rprefix/scyllatop/scyllatop.py" "$rusr/bin/scyllatop"
|
||||
if [ -z "$pkg" ] || [ "$pkg" = "kernel-conf" ]; then
|
||||
install -m755 -d "$rusr/lib/sysctl.d"
|
||||
install -m644 dist/common/sysctl.d/*.conf -Dt "$rusr"/lib/sysctl.d
|
||||
fi
|
||||
if [ -z "$pkg" ] || [ "$pkg" = "server" ]; then
|
||||
install -m755 -d "$retc/$sysconfdir"
|
||||
install -m755 -d "$retc/security/limits.d"
|
||||
install -m755 -d "$retc/scylla.d"
|
||||
install -m644 dist/common/sysconfig/scylla-server -Dt "$retc"/$sysconfdir
|
||||
install -m644 dist/common/limits.d/scylla.conf -Dt "$retc"/security/limits.d
|
||||
install -m644 dist/common/scylla.d/*.conf -Dt "$retc"/scylla.d
|
||||
|
||||
SBINFILES=$(cd dist/common/scripts/; ls scylla_*setup node_exporter_install node_health_check scylla_ec2_check scylla_kernel_check)
|
||||
install -d "$rusr"/sbin
|
||||
for i in $SBINFILES; do
|
||||
ln -srf "$rprefix/scripts/$i" "$rusr/sbin/$i"
|
||||
done
|
||||
install -d -m755 "$retc"/scylla "$rusr/lib/systemd/system" "$rusr/bin" "$rprefix/bin" "$rprefix/libexec" "$rprefix/libreloc" "$rprefix/scripts"
|
||||
install -m644 build/*.service -Dt "$rusr"/lib/systemd/system
|
||||
install -m644 dist/common/systemd/*.service -Dt "$rusr"/lib/systemd/system
|
||||
install -m644 dist/common/systemd/*.timer -Dt "$rusr"/lib/systemd/system
|
||||
install -m755 seastar/scripts/seastar-cpu-map.sh -Dt "$rprefix"/scripts
|
||||
install -m755 seastar/dpdk/usertools/dpdk-devbind.py -Dt "$rprefix"/scripts
|
||||
install -m755 bin/* -Dt "$rprefix/bin"
|
||||
# some files in libexec are symlinks, which "install" dereferences
|
||||
# use cp -P for the symlinks instead.
|
||||
install -m755 libexec/*.bin -Dt "$rprefix/libexec"
|
||||
for f in libexec/*; do
|
||||
if [[ "$f" != *.bin ]]; then
|
||||
cp -P "$f" "$rprefix/libexec"
|
||||
fi
|
||||
done
|
||||
install -m755 libreloc/* -Dt "$rprefix/libreloc"
|
||||
ln -srf "$rprefix/bin/scylla" "$rusr/bin/scylla"
|
||||
ln -srf "$rprefix/bin/iotune" "$rusr/bin/iotune"
|
||||
|
||||
install -m755 scylla-gdb.py -Dt "$rprefix"/scripts/
|
||||
# XXX: since housekeeping.cfg is mistakenly belongs to different package
|
||||
# in .rpm/.deb, we need this workaround to make package upgradable
|
||||
if $is_debian && $housekeeping; then
|
||||
install -m644 conf/housekeeping.cfg -Dt "$retc"/scylla.d
|
||||
fi
|
||||
install -d -m755 "$rdoc"/scylla
|
||||
install -m644 README.md -Dt "$rdoc"/scylla/
|
||||
install -m644 README-DPDK.md -Dt "$rdoc"/scylla
|
||||
install -m644 NOTICE.txt -Dt "$rdoc"/scylla/
|
||||
install -m644 ORIGIN -Dt "$rdoc"/scylla/
|
||||
install -d -m755 -d "$rdoc"/scylla/licenses/
|
||||
install -m644 licenses/* -Dt "$rdoc"/scylla/licenses/
|
||||
install -m755 -d "$root"/var/lib/scylla/
|
||||
install -m755 -d "$root"/var/lib/scylla/data
|
||||
install -m755 -d "$root"/var/lib/scylla/commitlog
|
||||
install -m755 -d "$root"/var/lib/scylla/hints
|
||||
install -m755 -d "$root"/var/lib/scylla/view_hints
|
||||
install -m755 -d "$root"/var/lib/scylla/coredump
|
||||
install -m755 -d "$root"/var/lib/scylla-housekeeping
|
||||
install -m755 -d "$rprefix"/swagger-ui
|
||||
cp -r swagger-ui/dist "$rprefix"/swagger-ui
|
||||
install -d -m755 -d "$rprefix"/api
|
||||
cp -r api/api-doc "$rprefix"/api
|
||||
install -d -m755 -d "$rprefix"/scyllatop
|
||||
cp -r tools/scyllatop/* "$rprefix"/scyllatop
|
||||
install -d -m755 -d "$rprefix"/scripts
|
||||
cp -r dist/common/scripts/* "$rprefix"/scripts
|
||||
ln -srf "$rprefix/scyllatop/scyllatop.py" "$rusr/bin/scyllatop"
|
||||
|
||||
PYSCRIPTS=$(find dist/common/scripts/ -maxdepth 1 -type f -exec grep -Pls '\A#!/usr/bin/env python3' {} +)
|
||||
for i in $PYSCRIPTS; do
|
||||
SBINFILES=$(cd dist/common/scripts/; ls scylla_*setup node_exporter_install node_health_check scylla_ec2_check scylla_kernel_check)
|
||||
install -d "$rusr"/sbin
|
||||
for i in $SBINFILES; do
|
||||
ln -srf "$rprefix/scripts/$i" "$rusr/sbin/$i"
|
||||
done
|
||||
|
||||
install -m755 scylla-gdb.py -Dt "$rprefix"/scripts/
|
||||
|
||||
PYSCRIPTS=$(find dist/common/scripts/ -maxdepth 1 -type f -exec grep -Pls '\A#!/usr/bin/env python3' {} +)
|
||||
for i in $PYSCRIPTS; do
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $rprefix/scripts/ --with-python3 "$root/$python3" $i
|
||||
done
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $rprefix/scripts/ --with-python3 "$root/$python3" $i
|
||||
done
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $rprefix/scripts/ --with-python3 "$root/$python3" \
|
||||
seastar/scripts/perftune.py seastar/scripts/seastar-addr2line seastar/scripts/perftune.py
|
||||
--installroot $rprefix/scripts/ --with-python3 "$root/$python3" \
|
||||
seastar/scripts/perftune.py seastar/scripts/seastar-addr2line seastar/scripts/perftune.py
|
||||
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $rprefix/scyllatop/ --with-python3 "$root/$python3" \
|
||||
tools/scyllatop/scyllatop.py
|
||||
./relocate_python_scripts.py \
|
||||
--installroot $rprefix/scyllatop/ --with-python3 "$root/$python3" \
|
||||
tools/scyllatop/scyllatop.py
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user