-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
556 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#Ignore mac hidden file | ||
.DS_Store | ||
#Ignore vs_code | ||
.vscode | ||
# Ignore quilt cache directory | ||
.pc/ | ||
# Ignore vagrant files | ||
.vagrant | ||
vagrant-data | ||
# Ignore coverage data | ||
cover_db | ||
# Ignore unibuild files | ||
unibuild-log | ||
unibuild-work/ | ||
unibuild-repo/ | ||
multiarch_build/ | ||
INSTALLED_FILES | ||
*.rpm | ||
*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# | ||
# Include a package-building Makefile depending on the system's | ||
# packaging model. | ||
# | ||
|
||
# unibuild-*.make will define this target. | ||
|
||
default: build | ||
|
||
|
||
# This is used to make sure the RPM and Debian templates aren't | ||
# included directly. | ||
UNIBUILD_PACKAGE_MAKE=1 | ||
|
||
|
||
# Figure out what needs to be run to get root. | ||
|
||
ifeq ($(shell id -u),0) | ||
RUN_AS_ROOT := | ||
else | ||
RUN_AS_ROOT := sudo | ||
endif | ||
|
||
|
||
|
||
# Figure out what kind of packaging this system uses. This uses the | ||
# same method as Unibuild. | ||
|
||
ifneq ($(wildcard /etc/redhat-release),) | ||
PACKAGE_FORMAT := rpm | ||
else ifneq ($(wildcard /etc/debian_version),) | ||
PACKAGE_FORMAT := deb | ||
else | ||
$(error Unable to determine the package format on this system.) | ||
endif | ||
|
||
|
||
# Standard directories and files | ||
|
||
TOP := $(CURDIR) | ||
|
||
UNIBUILD_DIR := unibuild-work | ||
TO_CLEAN += $(UNIBUILD_DIR) | ||
|
||
# Where patches live | ||
|
||
# Where the build happens | ||
BUILD_DIR := $(UNIBUILD_DIR)/build | ||
$(BUILD_DIR):: | ||
mkdir -p $@ | ||
TO_BUILD += $(BUILD_DIR) | ||
|
||
# Where the finished products go | ||
PRODUCTS_DIR := $(UNIBUILD_DIR)/products | ||
$(PRODUCTS_DIR): | ||
mkdir -p $@ | ||
TO_BUILD += $(PRODUCTS_DIR) | ||
|
||
# Build log | ||
BUILD_LOG := unibuild-log | ||
TO_CLEAN += $(BUILD_LOG) | ||
|
||
# A place to create temporary files | ||
TMP_DIR := $(UNIBUILD_DIR)/tmp | ||
$(TMP_DIR): | ||
mkdir -p $@ | ||
|
||
|
||
|
||
# Include the right version for this package format | ||
|
||
ifdef BUILD_PATH | ||
include $(BUILD_PATH)/$(PACKAGE_FORMAT).make | ||
else | ||
include ./$(PACKAGE_FORMAT).make | ||
endif | ||
|
||
|
||
|
||
# Standard targets | ||
|
||
build:: $(PRODUCTS_DIR) $(BUILD_DIR) | ||
bash get_dependency.sh grafana $(PACKAGE_FORMAT) | ||
mv *.$(PACKAGE_FORMAT) $(PRODUCTS_DIR) | ||
|
||
clean:: | ||
@for FILE in $(TO_CLEAN) ; \ | ||
do \ | ||
if [ -d "$${FILE}" ] ; \ | ||
then \ | ||
chmod -R +w "$${FILE}" ; \ | ||
fi \ | ||
done | ||
rm -rf $(TO_CLEAN) | ||
find . -name '*~' | xargs rm -rf | ||
|
||
ifdef AUTO_TARBALL | ||
clean:: | ||
find . -depth -name Makefile \ | ||
-exec /bin/sh -c \ | ||
'[ "{}" != "./Makefile" ] && make -C `dirname {}` clean' \; | ||
endif | ||
|
||
|
||
|
||
# Convenient shorthands for targets in the templates included above. | ||
|
||
b: build | ||
c: clean | ||
i: install | ||
d: dump | ||
|
||
cb: c b | ||
cbd: c b d | ||
cbi: c b i | ||
|
||
# CBI with forced clean afterward | ||
cbic: cbi | ||
@$(MAKE) clean | ||
|
||
# CBR with forced clean afterward | ||
cbdc: cbd | ||
@$(MAKE) clean | ||
|
||
|
||
# These are deprecated holdovers from the RPM-only days | ||
|
||
r: | ||
@printf "\n\nThe '$@' target is deprecated, use 'd' instead. Continuing shortly.\n\n" | ||
@sleep 3 | ||
@$(MAKE) d | ||
|
||
cbr: | ||
@printf "\n\nThe '$@' target is deprecated, use 'cbd' instead. Continuing shortly.\n\n" | ||
@sleep 3 | ||
@$(MAKE) cbd | ||
|
||
rpmdump: | ||
@printf "\n\nThe '$@' target is deprecated, use 'dump' instead. Continuing shortly.\n\n" | ||
@sleep 3 | ||
@$(MAKE) dump | ||
|
||
cbrc: | ||
@printf "\n\nThe '$@' target is deprecated, use 'cbdc' instead. Continuing shortly.\n\n" | ||
@sleep 3 | ||
@$(MAKE) cbdc | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# | ||
# Generic Makefile for Debian packagess | ||
# | ||
|
||
# | ||
# NO USER-SERVICEABLE PARTS BELOW THIS LINE | ||
# | ||
|
||
ifndef UNIBUILD_PACKAGE_MAKE | ||
$(error Include unibuild-package.make, not an environment-specific template.) | ||
endif | ||
|
||
# Don't expect user interaction | ||
RUN_AS_ROOT += DEBIAN_FRONTEND=noninteractive | ||
|
||
# TODO: --build flag should be removed after we can get an original | ||
# tarball for all build methods (tarball/source directory/none) | ||
|
||
|
||
ifeq ($(shell id -u),0) | ||
ROOT_CMD := | ||
else | ||
ROOT_CMD := --root-cmd=sudo | ||
endif | ||
|
||
|
||
# This target is for internal use only. | ||
_built: | ||
@if [ ! -d '$(PRODUCTS_DIR)' ] ; \ | ||
then \ | ||
printf "\nPackage is not built.\n\n" ; \ | ||
false ; \ | ||
fi | ||
|
||
install:: _built | ||
@printf "\nInstall packages:\n" | ||
@find '$(PRODUCTS_DIR)' -name '*.deb' \ | ||
| fgrep -v -- '-build-deps' \ | ||
| sed -e 's|^.*/||; s/^/ /' | ||
@echo | ||
@find '$(PRODUCTS_DIR)' -name '*.deb' \ | ||
| fgrep -v -- '-build-deps' \ | ||
| sed -e 's|^|./|g' \ | ||
| $(RUN_AS_ROOT) xargs apt-get -y --reinstall install | ||
|
||
|
||
# Copy the products to a destination named by PRODUCTS_DEST and add | ||
# additional info to the repo. | ||
|
||
REPO_UNIBUILD := $(PRODUCTS_DEST)/unibuild | ||
DEBIAN_PACKAGE_ORDER := $(REPO_UNIBUILD)/debian-package-order | ||
|
||
install-products: $(PRODUCTS_DIR) | ||
ifndef PRODUCTS_DEST | ||
@printf "\nERROR: No PRODUCTS_DEST defined for $@.\n\n" | ||
@false | ||
endif | ||
@if [ ! -d "$(PRODUCTS_DEST)" ] ; then \ | ||
printf "\nERROR: $(PRODUCTS_DEST) is not a directory.\n\n" ; \ | ||
false ; \ | ||
fi | ||
find "$(PRODUCTS_DIR)" \( \ | ||
-name "*.deb" -o -name "*.dsc" -o -name "*.changes" -o -name "*.buildinfo" -o -name "*.build" -o -name "*.tar.*" -o -name "*.diff.gz" \ | ||
\) -exec cp {} "$(PRODUCTS_DEST)" \; | ||
mkdir -p "$(REPO_UNIBUILD)" | ||
sed -e ':a;/\\\s*$$/{N;s/\\\s*\n//;ba}' "$(CONTROL)" \ | ||
| awk '$$1 == "Source:" { print $$2; exit }' \ | ||
>> "$(DEBIAN_PACKAGE_ORDER)" | ||
|
||
|
||
# TODO: This doesn't work. | ||
uninstall:: | ||
@printf "\nUninstall packages:\n" | ||
@awk '$$1 == "Package:" { print $$2 }' ./unibuild/unibuild-packaging/deb/control \ | ||
| ( while read PACKAGE ; do \ | ||
echo " $${PACKAGE}" ; \ | ||
yes | $(RUN_AS_ROOT) apt remove -f $$PACKAGE ; \ | ||
done ) | ||
|
||
|
||
dump:: _built | ||
@find '$(PRODUCTS_DIR)' -name "*.deb" \ | ||
| ( \ | ||
while read DEB ; \ | ||
do \ | ||
echo "$$DEB" | sed -e 's|^$(PRODUCTS_DIR)/||' | xargs -n 1 printf "\n%s:\n" ; \ | ||
dpkg --contents "$$DEB" ; \ | ||
echo ; \ | ||
done) | ||
|
||
# Make this available so the primitive build process can tell if | ||
# loading up was successful. | ||
UNIBUILD_MAKE_FULLY_INCLUDED := 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
echo "Illegal number of parameters" | ||
echo "Usage: $0 (PACKAGE|all) DEB/RPM" | ||
exit 1 | ||
fi | ||
|
||
package=$1 | ||
version=$(echo $2 | tr [:lower:] [:upper:]) | ||
|
||
if [ "$version" != "DEB" ] && [ "$version" != "RPM" ]; then | ||
echo "Unknown OS version. Use DEB or RPM" | ||
exit 1 | ||
fi | ||
|
||
my_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
package_list=${my_dir}"/packages.yml" | ||
|
||
if [ "${package}" = "all" ]; then | ||
package=$(awk -F ':' '/^[^ ]+:/ {print $1}' ${package_list}) | ||
fi | ||
|
||
for p in ${package}; do | ||
# Get url to download package | ||
if [ "$version" = "DEB" ]; then | ||
url=$(grep -A4 ^${p}: ${package_list} | awk '/deb_url:/ { print $2 }') | ||
filename=$(grep -A4 ^${p}: ${package_list} | awk '/deb_name:/ { print $2 }') | ||
elif [ "$version" = "RPM" ]; then | ||
url=$(grep -A4 ^${p}: ${package_list} | awk '/rpm_url:/ { print $2 }') | ||
filename=$(grep -A4 ^${p}: ${package_list} | awk '/rpm_name:/ { print $2 }') | ||
fi | ||
|
||
if [ ! -z $url ]; then | ||
curl -sS -o $filename -L $url; | ||
ls -lh $filename | ||
else | ||
echo "skipping $p"; | ||
fi | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
grafana: | ||
rpm_url: https://dl.grafana.com/oss/release/grafana-10.2.0-1.x86_64.rpm | ||
rpm_name: grafana-10.2.0-1.x86_64.rpm | ||
deb_url: https://dl.grafana.com/oss/release/grafana_10.2.0_amd64.deb | ||
deb_name: grafana_10.2.0_amd64.deb | ||
grafana-arm64: | ||
rpm_url: | ||
rpm_name: | ||
deb_url: https://dl.grafana.com/oss/release/grafana_10.2.0_arm64.deb | ||
deb_name: grafana_10.2.0_arm64.deb |
Oops, something went wrong.