Skip to content

Commit

Permalink
Merge pull request #17 from ggtakec/update_alpine
Browse files Browse the repository at this point in the history
Updated building/packaging logic for ALPINE
  • Loading branch information
ggtakec authored Mar 6, 2023
2 parents 5424f3a + 50eee36 commit 1cd1bb6
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 44 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Mon, Oct 31 2022
# REVISION: 1.2
# REVISION: 1.3
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#==============================================================
Expand Down
3 changes: 3 additions & 0 deletions buildutils/APKBUILD.templ.in
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ check() {
package() {
install -Dm755 src/"$pkgname"-helper "$pkgdir"/usr/bin/"$pkgname"-helper
install -Dm644 src/"$pkgname"-helper.conf "$pkgdir"/etc/antpickax/"$pkgname"-helper.conf

install -m 0777 -d "$pkgdir"/var/lib/antpickax
install -m 0777 -d "$pkgdir"/var/run/antpickax
}

# [NOTE]
Expand Down
2 changes: 2 additions & 0 deletions buildutils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ EXTRA_DIST =make_variables.sh \
debian_build.sh \
debian_build_copy.conf \
rpm_build.sh \
alpine_build.sh \
k2hr3-get-resource.install \
k2hr3-get-resource.postinst \
k2hr3-get-resource.post-install \
k2hr3-get-resource.pre-deinstall

Expand Down
24 changes: 13 additions & 11 deletions buildutils/alpine_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Jan 13 2023
# REVISION: 1.1
# REVISION: 1.2
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand Down
24 changes: 13 additions & 11 deletions buildutils/debian_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Apr 13 2018
# REVISION:
# REVISION: 1.1
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand Down
36 changes: 36 additions & 0 deletions buildutils/k2hr3-get-resource.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
#
# K2HR3 Utilities - Get K2HR3 Resource Helper for Systemd service
#
# Copyright 2022 Yahoo Japan Corporation.
#
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
# common management information for the cloud.
# K2HR3 can dynamically manage information as "who", "what", "operate".
# These are stored as roles, resources, policies in K2hdkc, and the
# client system can dynamically read and modify these information.
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Takeshi Nakatani
# CREATE: Mon, Mar 6 2023
# REVISION:
#

#
# Create /var/{lib,run}/antpickax directory
#
mkdir -p /var/lib/antpickax
chmod 0777 /var/lib/antpickax
mkdir -p /var/run/antpickax
chmod 0777 /var/run/antpickax

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
4 changes: 4 additions & 0 deletions buildutils/k2hr3-get-resource.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ install -D -m 644 src/@PACKAGE_NAME@.timer %{buildroot}/lib/systemd/system/@PACK
install -D -m 644 src/@PACKAGE_NAME@.service %{buildroot}/lib/systemd/system/@PACKAGE_NAME@.service
install -D -m 755 src/@PACKAGE_NAME@-helper %{buildroot}/usr/libexec/@PACKAGE_NAME@-helper
install -D -m 644 src/@PACKAGE_NAME@-helper.conf %{buildroot}/etc/antpickax/@PACKAGE_NAME@-helper.conf
mkdir -p %{buildroot}/var/lib/antpickax
mkdir -p %{buildroot}/var/run/antpickax

%if %{make_check}
%check
Expand All @@ -95,6 +97,8 @@ install -D -m 644 src/@PACKAGE_NAME@-helper.conf %{buildroot}/etc/antpickax/@PAC
/lib/systemd/system/@PACKAGE_NAME@.service
/usr/libexec/@PACKAGE_NAME@-helper
/etc/antpickax/*
%dir %attr(0777,root,root) /var/lib/antpickax
%dir %attr(0777,root,root) /var/run/antpickax

%preun
%systemd_preun @PACKAGE_NAME@.timer
Expand Down
24 changes: 13 additions & 11 deletions buildutils/rpm_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# AUTHOR: Takeshi Nakatani
# CREATE: Thu, Nov 22 2018
# REVISION:
# REVISION: 1.1
#

#==============================================================
Expand All @@ -33,16 +33,18 @@ PIPEFAILURE_FILE="/tmp/.pipefailure.$(od -An -tu4 -N4 /dev/random | tr -d ' \n')
#
# For shellcheck
#
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
if command -v locale >/dev/null 2>&1; then
if locale -a | grep -q -i '^[[:space:]]*C.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*C.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
elif locale -a | grep -q -i '^[[:space:]]*en_US.utf8[[:space:]]*$'; then
LANG=$(locale -a | grep -i '^[[:space:]]*en_US.utf8[[:space:]]*$' | sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' | tr -d '\n')
LC_ALL="${LANG}"
export LANG
export LC_ALL
fi
fi

#
Expand Down

0 comments on commit 1cd1bb6

Please sign in to comment.