mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Modernize Debian packaging.
This commit is contained in:
committed by
Dan Christian Bogos
parent
0785141218
commit
3ec26e9320
115
debian/README.source
vendored
Normal file
115
debian/README.source
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
CGRateS for Debian
|
||||
------------------
|
||||
|
||||
CGRateS dependencies are not packaged separately, an additional
|
||||
component is used alongside the upstream tarball.
|
||||
|
||||
For package builds both tarballs need to be updated.
|
||||
|
||||
The build.sh script in the debian directory automates the process.
|
||||
It creates the .orig.tar.gz using git archive, and uses go get to
|
||||
download the sources for the dependencies component. The script then
|
||||
proceed to build the package in a cowbuilder chroot.
|
||||
|
||||
The script has a few dependencies:
|
||||
|
||||
git To get the commit details for the package version
|
||||
distro-info To get the release version for the distribution
|
||||
dpkg-dev To parse the debian/changelog file and dpkg-buildpackage
|
||||
devscripts To set the package version and distribution
|
||||
pbuilder To build the package with pdebuild
|
||||
cowbuilder To have a more performant chroot
|
||||
|
||||
Because the clean target is also executed outside the chroot these build
|
||||
dependencies need to be installed outside the chroot too:
|
||||
|
||||
debhelper For dh sequencer support in debian/rules
|
||||
dh-golang For the golang buildsystem used by debhelper
|
||||
|
||||
The cowbuilder chroots should have the upstream Go installed after
|
||||
creation:
|
||||
|
||||
sudo -i
|
||||
export CODENAME=bookworm
|
||||
export VERSION=1.21.4
|
||||
cowbuilder --create \
|
||||
--distribution ${CODENAME} \
|
||||
--architecture amd64 \
|
||||
--basepath /var/cache/pbuilder/base-${CODENAME}+go.cow \
|
||||
--mirror http://ftp.nl.debian.org/debian/ \
|
||||
--components 'main contrib non-free non-free-firmware'
|
||||
wget https://go.dev/dl/go${VERSION}.linux-amd64.tar.gz -P /tmp
|
||||
tar xavf /tmp/go${VERSION}.linux-amd64.tar.gz \
|
||||
-C /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local
|
||||
echo "export PATH=\$PATH:/usr/local/go/bin" >> /var/cache/pbuilder/base-${CODENAME}+go.cow/root/.bashrc
|
||||
|
||||
To upgrade the Go version in an existing chroot replace /usr/local/go
|
||||
in the chroot:
|
||||
|
||||
sudo -i
|
||||
export CODENAME=bookworm
|
||||
export VERSION=1.21.6
|
||||
wget https://go.dev/dl/go${VERSION}.linux-amd64.tar.gz -P /tmp
|
||||
rm -rf /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local/go/
|
||||
tar xavf /tmp/go${VERSION}.linux-amd64.tar.gz \
|
||||
-C /var/cache/pbuilder/base-${CODENAME}+go.cow/usr/local
|
||||
|
||||
To not have the upstream Go installed outside the chroot, the packaged
|
||||
Go can be used:
|
||||
|
||||
GO=/usr/lib/go-1.21/bin/go make -C packages/ deb
|
||||
|
||||
To have the build artifacts alongside the source package in the parent
|
||||
directory instead of /var/cache/pbuilder/result configure the path in
|
||||
~/.pbuilderrc:
|
||||
|
||||
BUILDRESULT=".."
|
||||
|
||||
To have lintian run after the package build in the chroot configure the
|
||||
hook:
|
||||
|
||||
sudo -i
|
||||
mkdir -p /var/cache/pbuilder/hooks.d
|
||||
cat <<EOF > /var/cache/pbuilder/hooks.d/B90lintian
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n "\${LINTIAN}" ] && [ "\${LINTIAN}" = "0" ]; then
|
||||
echo
|
||||
echo "Not running lintian"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
install_packages() {
|
||||
apt-get -y "\${APTGETOPT[@]}" install "\$@"
|
||||
rc=\$?
|
||||
|
||||
if [ "\${rc}" -ne 0 ]; then
|
||||
echo
|
||||
echo "Not running lintian"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
install_packages lintian
|
||||
|
||||
set -e
|
||||
|
||||
echo "+++ lintian output +++"
|
||||
|
||||
#su -c "lintian -I --show-overrides /tmp/buildd/*.changes" - pbuilder
|
||||
# use this version if you don't want lintian to fail the build
|
||||
su -c "lintian -I --show-overrides --pedantic -E /tmp/buildd/*.changes; :" - pbuilder
|
||||
|
||||
echo "+++ end of lintian output +++"
|
||||
|
||||
EOF
|
||||
|
||||
And configure the path to the hooks directory in ~/.pbuilderrc:
|
||||
|
||||
HOOKDIR="/var/cache/pbuilder/hooks.d/"
|
||||
|
||||
To skip running the lintian set LINTIAN=0 in the environment. When the
|
||||
lintian package fails to install, like during perl transitions, the build
|
||||
won't fail.
|
||||
271
debian/build.sh
vendored
Executable file
271
debian/build.sh
vendored
Executable file
@@ -0,0 +1,271 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Dependencies
|
||||
|
||||
PACKAGES=(
|
||||
git
|
||||
distro-info
|
||||
dpkg-dev
|
||||
devscripts
|
||||
pbuilder
|
||||
cowbuilder
|
||||
debhelper
|
||||
dh-golang
|
||||
)
|
||||
|
||||
MISSING=()
|
||||
for PKG in "${PACKAGES[@]}"; do
|
||||
INSTALLED="$(dpkg-query -W --showformat='${Status}' "${PKG}" | grep -c " ok installed")"
|
||||
if [ "${INSTALLED}" != "1" ]; then
|
||||
MISSING+=("${PKG}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${#MISSING[@]}" != "0" ]; then
|
||||
echo "Error: Not all dependencies are installed: ${MISSING[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Variables
|
||||
|
||||
DEFAULT_DISTRIBUTION="bookworm"
|
||||
|
||||
if [ -z "${DISTRIBUTION}" ]; then
|
||||
DISTRIBUTION="${DEFAULT_DISTRIBUTION}"
|
||||
fi
|
||||
|
||||
DEFAULT_RELEASE_VERSION="$(distro-info -r --series "${DISTRIBUTION}" 2> /dev/null)"
|
||||
|
||||
if [ -z "${RELEASE_VERSION}" ]; then
|
||||
RELEASE_VERSION="${DEFAULT_RELEASE_VERSION}"
|
||||
fi
|
||||
|
||||
DEFAULT_CHROOT="/var/cache/pbuilder/base-${DISTRIBUTION}+go.cow"
|
||||
|
||||
if [ -z "${CHROOT}" ]; then
|
||||
CHROOT="${DEFAULT_CHROOT}"
|
||||
fi
|
||||
|
||||
DEFAULT_NOCHROOT="0"
|
||||
|
||||
if [ -z "${NOCHROOT}" ]; then
|
||||
NOCHROOT="${DEFAULT_NOCHROOT}"
|
||||
fi
|
||||
|
||||
DEFAULT_DEBUG="0"
|
||||
|
||||
if [ -z "${DEBUG}" ]; then
|
||||
DEBUG="${DEFAULT_DEBUG}"
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Commandline options
|
||||
|
||||
OPTS=$(getopt -o D:R:C:Ndh --long distribution:release-version:,chroot:,nochroot,debug,help -n "$(basename "$0")" -- "$@")
|
||||
RC=$?
|
||||
|
||||
if [ "${RC}" != 0 ]; then
|
||||
echo "Error: Failed to parse options."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "${OPTS}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-D|--distribution)
|
||||
shift
|
||||
DISTRIBUTION="$1"
|
||||
shift
|
||||
;;
|
||||
-R|--release-version)
|
||||
shift
|
||||
RELEASE_VERSION="$1"
|
||||
shift
|
||||
;;
|
||||
-C|--chroot)
|
||||
shift
|
||||
CHROOT="$1"
|
||||
shift
|
||||
;;
|
||||
-N|--nochroot)
|
||||
shift
|
||||
DEBUG=1
|
||||
;;
|
||||
-d|--debug)
|
||||
shift
|
||||
DEBUG=1
|
||||
;;
|
||||
-h|--help)
|
||||
shift
|
||||
|
||||
echo "Usage: $(basename "$0") [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo "-D, --distribution <NAME> Distribution to use in changelog"
|
||||
echo " Default: ${DEFAULT_DISTRIBUTION}"
|
||||
echo "-R, --release-version <NUMBER> Version to use in ~deb<N>u1 suffix"
|
||||
echo " Default: ${DEFAULT_RELEASE_VERSION}"
|
||||
echo " Set to 0 to not append the suffix"
|
||||
echo "-C, --chroot <PATH> Path to cowbuilder chroot"
|
||||
echo " Default: ${DEFAULT_CHROOT}"
|
||||
echo "-N, --nochroot Don't use chroot for package build"
|
||||
echo "-d, --debug Enable debug output"
|
||||
echo "-h, --help Display this usage information"
|
||||
echo
|
||||
echo "Environment variables:"
|
||||
echo "DISTRIBUTION Distribution to use in changelog"
|
||||
echo "RELEASE_VERSION Version to use in ~deb<N>u1 suffix"
|
||||
echo " Set to 0 to not append the suffix"
|
||||
echo "CHROOT Path to cowbuilder chroot"
|
||||
echo "NOCHROOT Don't use chroot for package build"
|
||||
echo "DEBUG Enable debug output"
|
||||
echo " Set to 1 to enable debug output"
|
||||
|
||||
exit 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
|
||||
if [ "${DEBUG}" = "1" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
#
|
||||
# Create .orig.tar.gz
|
||||
#
|
||||
|
||||
DEBIAN_DIR="$(dirname "$0")"
|
||||
SOURCE_DIR="$(dirname "${DEBIAN_DIR}")"
|
||||
|
||||
cd "${SOURCE_DIR}" || exit 1
|
||||
|
||||
PACKAGE="$(dpkg-parsechangelog -S Source)"
|
||||
VERSION="$(grep -E "(^|\s+)Version\s*=\s*\"(\S+)\"\s*" utils/consts.go | awk -F'"' '{print $2}' | sed 's/^v//g')"
|
||||
|
||||
PATTERN="^[0-9]+.[0-9]+.[0-9]+(~[a-z0-9]+)?$"
|
||||
|
||||
if [[ ${VERSION} =~ ${PATTERN} ]]; then
|
||||
true
|
||||
else
|
||||
echo "Error: Failed to extract version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GIT_COMMIT="HEAD"
|
||||
|
||||
GIT_TAG_LOG="$(git tag -l --points-at "${GIT_COMMIT}")"
|
||||
|
||||
COMMIT_DATE="$(git log -n1 --format=format:%cd --date="format:%Y%m%d%H%M%S" "${GIT_COMMIT}")"
|
||||
COMMIT_HASH="$(git log -n1 --format=format:%h "${GIT_COMMIT}")"
|
||||
|
||||
if [ -n "${GIT_TAG_LOG}" ]; then
|
||||
PACKAGE_VERSION="${VERSION}"
|
||||
else
|
||||
PACKAGE_VERSION="${VERSION}+${COMMIT_DATE}+${COMMIT_HASH}"
|
||||
fi
|
||||
|
||||
ORIG_TARBALL="../${PACKAGE}_${PACKAGE_VERSION}.orig.tar.gz"
|
||||
|
||||
if [ ! -e "${ORIG_TARBALL}" ]; then
|
||||
echo "Creating ${ORIG_TARBALL} from ${GIT_COMMIT}"
|
||||
git archive -o "${ORIG_TARBALL}" --format tar.gz --prefix "${PACKAGE}-${VERSION}/" "${GIT_COMMIT}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create .orig.tar-dependencies.gz
|
||||
#
|
||||
|
||||
DEPENDENCIES_TARBALL="../${PACKAGE}_${PACKAGE_VERSION}.orig-dependencies.tar.gz"
|
||||
|
||||
if [ ! -e "${DEPENDENCIES_TARBALL}" ]; then
|
||||
./debian/create-components.sh "${ORIG_TARBALL}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Unpack .orig.tar-dependencies.gz
|
||||
#
|
||||
|
||||
if [ ! -e "${DEPENDENCIES_TARBALL}" ]; then
|
||||
echo "Error: No dependencies tarball"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEPENDENCIES_PATH="dependencies"
|
||||
|
||||
if [ ! -e "${DEPENDENCIES_PATH}" ]; then
|
||||
echo "Unpacking dependencies"
|
||||
tar xaf "${DEPENDENCIES_TARBALL}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Update changelog
|
||||
#
|
||||
|
||||
CHANGELOG_VERSION="$(dpkg-parsechangelog -S Version)"
|
||||
|
||||
PACKAGE_REVISION="${PACKAGE_VERSION}-1"
|
||||
|
||||
if [[ ${RELEASE_VERSION} =~ ^[0-9]+$ ]] && [ "${RELEASE_VERSION}" != "0" ]; then
|
||||
PACKAGE_REVISION="${PACKAGE_REVISION}~deb${RELEASE_VERSION}u1"
|
||||
fi
|
||||
|
||||
if [ "${CHANGELOG_VERSION}" != "${PACKAGE_REVISION}" ]; then
|
||||
echo "Updating changelog"
|
||||
dch -v "${PACKAGE_REVISION}" \
|
||||
-m "Package build for git commit ${COMMIT_HASH} (${COMMIT_DATE})." \
|
||||
-D "${DISTRIBUTION}" --force-distribution
|
||||
fi
|
||||
|
||||
#
|
||||
# Build package
|
||||
#
|
||||
|
||||
if [ -n "${GIT_TAG_LOG}" ]; then
|
||||
GIT_COMMIT_DATE=""
|
||||
GIT_COMMIT_HASH=""
|
||||
else
|
||||
GIT_COMMIT_DATE="$(git log -n1 --format=format:%cI "${GIT_COMMIT}")"
|
||||
GIT_COMMIT_HASH="$(git log -n1 --format=format:%H "${GIT_COMMIT}")"
|
||||
fi
|
||||
|
||||
export GIT_COMMIT_DATE
|
||||
export GIT_COMMIT_HASH
|
||||
|
||||
echo "Building package"
|
||||
if [ "${NOCHROOT}" = "0" ]; then
|
||||
pdebuild --pbuilder cowbuilder -- --basepath "${CHROOT}"
|
||||
else
|
||||
MAINTAINER_EMAIL="$(dpkg-parsechangelog -S Maintainer | awk -F'<' '{print $2}' | sed 's/>$//')"
|
||||
KEY_COUNT="$(gpg --list-secret-keys "${MAINTAINER_EMAIL}" 2> /dev/null | grep -c "^sec")"
|
||||
|
||||
if [ "${KEY_COUNT}" = "0" ]; then
|
||||
NO_SIGN="--no-sign"
|
||||
else
|
||||
NO_SIGN=""
|
||||
fi
|
||||
|
||||
dpkg-buildpackage -rfakeroot -tc "${NO_SIGN}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Undo changes
|
||||
#
|
||||
|
||||
echo "Undoing changes"
|
||||
rm -rf dependencies/
|
||||
git checkout debian/changelog
|
||||
|
||||
21
debian/cgrates.service
vendored
Normal file
21
debian/cgrates.service
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Stop dance for cgrates
|
||||
# =======================
|
||||
|
||||
[Unit]
|
||||
Description=Control CGRateS - carrier grade real-time charging system
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=-/etc/default/cgrates
|
||||
ExecStart=/usr/bin/cgr-engine $DAEMON_OPTS
|
||||
KillMode=mixed
|
||||
User=cgrates
|
||||
Group=cgrates
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
Restart=on-failure
|
||||
SyslogIdentifier=cgr-engine
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
cgrates (0.11.0~dev-1) UNRELEASED; urgency=medium
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- DanB <danb@cgrates.org> Thu, 07 Sep 2023 20:34:34 +0200
|
||||
1
debian/clean
vendored
Normal file
1
debian/clean
vendored
Normal file
@@ -0,0 +1 @@
|
||||
vendor/
|
||||
24
debian/control
vendored
Normal file
24
debian/control
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Source: cgrates
|
||||
Maintainer: DanB <danb@cgrates.org>
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
dh-exec,
|
||||
dh-golang
|
||||
Standards-Version: 4.6.2
|
||||
Vcs-Browser: https://github.com/cgrates/cgrates
|
||||
Vcs-Git: https://github.com/cgrates/cgrates.git
|
||||
Homepage: http://cgrates.org
|
||||
Rules-Requires-Root: no
|
||||
XS-Go-Import-Path: github.com/cgrates/cgrates
|
||||
|
||||
Package: cgrates
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Suggests: default-mysql-server,
|
||||
redis-server
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Description: Carrier Grade Real-time Charging System
|
||||
CGRateS is a very fast and easily scalable real-time enterprise billing
|
||||
suite targeted at ISPs and telecom operators (but not only).
|
||||
26
debian/copyright
vendored
Normal file
26
debian/copyright
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: CGRateS
|
||||
Source: https://github.com/cgrates/cgrates
|
||||
|
||||
Files: *
|
||||
Copyright: 2019, DanB <danb@cgrates.org>
|
||||
License: GPL-3+
|
||||
|
||||
Files: debian/*
|
||||
Copyright: Bas Couwenberg <sebastic@xs4all.nl>
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
On Debian systems, the full text of the GNU General Public License
|
||||
version 3 can be found in the file
|
||||
`/usr/share/common-licenses/GPL-3'.
|
||||
46
debian/create-components.sh
vendored
Executable file
46
debian/create-components.sh
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <ORIGTARGZ>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${GO}" ]; then
|
||||
GO="/usr/local/go/bin/go"
|
||||
fi
|
||||
|
||||
UPSTREAM_TARBALL="$(realpath -s "$1")"
|
||||
|
||||
if [ ! -e "${UPSTREAM_TARBALL}" ]; then
|
||||
echo "Error: Upstream tarball not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMPONENT_NAME="dependencies"
|
||||
COMPONENT_TARBALL="${UPSTREAM_TARBALL//.orig.tar/.orig-${COMPONENT_NAME}.tar}"
|
||||
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
|
||||
GOPATH="${TEMP_DIR}/${COMPONENT_NAME}"
|
||||
export GOPATH
|
||||
|
||||
echo "Unpacking upstream tarball: ${UPSTREAM_TARBALL} into: ${TEMP_DIR}"
|
||||
tar --strip-components=1 -xaf "${UPSTREAM_TARBALL}" -C "${TEMP_DIR}"
|
||||
|
||||
for CMD_DIR in "${TEMP_DIR}/cmd/"*; do
|
||||
echo "Getting $(basename "${CMD_DIR}") dependencies into: ${GOPATH}"
|
||||
cd "${CMD_DIR}" || exit 1
|
||||
"${GO}" get .
|
||||
cd "${OLDPWD}" || exit 1
|
||||
done
|
||||
|
||||
echo "Fixing permissions for: ${GOPATH}"
|
||||
chmod -R u+w "${GOPATH}"
|
||||
|
||||
echo "Creating component tarball: ${COMPONENT_TARBALL}"
|
||||
cd "${TEMP_DIR}" || exit 1
|
||||
tar --owner root --group root -caf "${COMPONENT_TARBALL}" "${COMPONENT_NAME}"
|
||||
cd "${OLDPWD}" || exit 1
|
||||
|
||||
echo "Removing temporary directory: ${TEMP_DIR}"
|
||||
rm -rf "${TEMP_DIR}"
|
||||
9
debian/dirs
vendored
Normal file
9
debian/dirs
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var/lib/cgrates/cache_dump
|
||||
var/log/cgrates
|
||||
var/spool/cgrates/analyzers
|
||||
var/spool/cgrates/cdre/csv
|
||||
var/spool/cgrates/cdre/fwv
|
||||
var/spool/cgrates/ers/in
|
||||
var/spool/cgrates/ers/out
|
||||
var/spool/cgrates/failed_posts
|
||||
var/spool/cgrates/tpe
|
||||
5
debian/install
vendored
Executable file
5
debian/install
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/dh-exec
|
||||
data/conf/cgrates/ etc/
|
||||
data/conf/logging/logrotate.conf => etc/logrotate.d/cgrates
|
||||
data/conf/logging/rsyslog.conf => etc/rsyslog.d/25-cgrates.conf
|
||||
data/* usr/share/cgrates/
|
||||
21
debian/lintian-overrides
vendored
Normal file
21
debian/lintian-overrides
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Not picked up by go
|
||||
hardening-no-pie [usr/bin/*]
|
||||
|
||||
# Not a problem
|
||||
no-manual-page [usr/bin/*]
|
||||
|
||||
# Not a problem
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/cgrates/*]
|
||||
|
||||
# Only systemd is supported
|
||||
package-supports-alternative-init-but-no-init.d-script [lib/systemd/system/cgrates.service]
|
||||
|
||||
# No good alternative
|
||||
recursive-privilege-change "chown -R" [postinst:*]
|
||||
|
||||
# Sources for dependencies are included as-is
|
||||
spelling-error-in-binary *
|
||||
|
||||
# Unported python2 scripts
|
||||
unusual-interpreter /usr/bin/python [usr/share/cgrates/*/migrator/*.py]
|
||||
|
||||
48
debian/postinst
vendored
Executable file
48
debian/postinst
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id$
|
||||
|
||||
PKG=cgrates
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
#
|
||||
# quoting from the policy:
|
||||
# Any necessary prompting should almost always be confined to the
|
||||
# post-installation script, and should be protected with a conditional
|
||||
# so that unnecessary prompting doesn't happen if a package's
|
||||
# installation fails and the `postinst' is called with `abort-upgrade',
|
||||
# `abort-remove' or `abort-deconfigure'.
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
adduser --quiet --system --group --disabled-password --shell /bin/false --gecos "CGRateS" cgrates || true
|
||||
chown -R cgrates:cgrates /var/spool/cgrates/
|
||||
chown -R cgrates:cgrates /var/lib/cgrates/
|
||||
chown -R cgrates:cgrates /usr/share/cgrates/
|
||||
chown root:adm /var/log/cgrates
|
||||
chmod 775 /var/log/cgrates
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
45
debian/rules
vendored
Executable file
45
debian/rules
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DH_VERBOSE=1
|
||||
|
||||
# Enable hardening build flags
|
||||
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
|
||||
|
||||
export DH_GOLANG_BUILDPKG=github.com/cgrates/cgrates/cmd/cgr-console \
|
||||
github.com/cgrates/cgrates/cmd/cgr-engine \
|
||||
github.com/cgrates/cgrates/cmd/cgr-loader \
|
||||
github.com/cgrates/cgrates/cmd/cgr-migrator \
|
||||
github.com/cgrates/cgrates/cmd/cgr-tester
|
||||
|
||||
export GO111MODULE=on
|
||||
|
||||
%:
|
||||
dh $@ --builddirectory=_build --buildsystem=golang
|
||||
|
||||
override_dh_auto_clean:
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_clean
|
||||
|
||||
override_dh_auto_configure:
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_configure
|
||||
|
||||
execute_after_dh_auto_configure:
|
||||
(mkdir -p _build/pkg && cd _build/pkg && ln -s ../../dependencies/pkg/* .)
|
||||
|
||||
override_dh_auto_build:
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_build -- \
|
||||
-ldflags "-X 'github.com/cgrates/cgrates/utils.GitCommitDate=$$GIT_COMMIT_DATE' \
|
||||
-X 'github.com/cgrates/cgrates/utils.GitCommitHash=$$GIT_COMMIT_HASH'"
|
||||
|
||||
override_dh_auto_test:
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_test
|
||||
|
||||
override_dh_auto_install:
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" dh_auto_install -- --no-source
|
||||
|
||||
execute_after_dh_install:
|
||||
tar -xavf debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz \
|
||||
-C debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/
|
||||
rm -f debian/cgrates/usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/freeswitch_conf.tar.gz
|
||||
|
||||
override_dh_dwz:
|
||||
dh_dwz -Xcgr-console -Xcgr-engine -Xcgr-loader -Xcgr-migrator -Xcgr-tester
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
7
debian/source/lintian-overrides
vendored
Normal file
7
debian/source/lintian-overrides
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Dependencies are included as-is
|
||||
source-is-missing [dependencies/*]
|
||||
source-contains-prebuilt-windows-binary [dependencies/*]
|
||||
|
||||
# Not worth the effort for unofficial package
|
||||
add-component-copyright dependencies [debian/copyright]
|
||||
|
||||
5
debian/upstream/metadata
vendored
Normal file
5
debian/upstream/metadata
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
Bug-Database: https://github.com/cgrates/cgrates/issues
|
||||
Bug-Submit: https://github.com/cgrates/cgrates/issues/new
|
||||
Repository: https://github.com/cgrates/cgrates.git
|
||||
Repository-Browse: https://github.com/cgrates/cgrates
|
||||
7
debian/watch
vendored
Normal file
7
debian/watch
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#version=4
|
||||
#opts=\
|
||||
#dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
|
||||
#uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
|
||||
#filenamemangle=s/(?:.*?)?(?:rel|v|cgrates)?[\-\_]?(\d\S+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/cgrates-$1.$2/ \
|
||||
#https://github.com/cgrates/cgrates/tags \
|
||||
#(?:.*?/archive/(?:.*?/)?)?(?:rel|v|cgrates)?[\-\_]?(\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
|
||||
Reference in New Issue
Block a user