mirror of
https://github.com/gwebu-team/profile.d.git
synced 2025-12-11 12:15:47 +00:00
Compare commits
3 commits
45d926a3a9
...
2ad5d376af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ad5d376af | ||
|
|
b3f0f66356 | ||
|
|
58223f0e8a |
6 changed files with 98 additions and 16 deletions
14
Dockerfile-build
Normal file
14
Dockerfile-build
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
FROM rockylinux:9 as build
|
||||||
|
|
||||||
|
WORKDIR /root/profile.d
|
||||||
|
|
||||||
|
COPY ./ .
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
dnf -y update && \
|
||||||
|
dnf -y install rpmdevtools make
|
||||||
|
|
||||||
|
# dnf -y install dnf-plugins-core epel-release && \
|
||||||
|
# /usr/bin/crb enable && \
|
||||||
|
|
||||||
|
RUN ./build.sh
|
||||||
20
Makefile
20
Makefile
|
|
@ -11,11 +11,12 @@ help:
|
||||||
@echo "▀▀▀▀▀▀"
|
@echo "▀▀▀▀▀▀"
|
||||||
@echo
|
@echo
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " dist: create source distribution package in dist/"
|
@echo " dist: Create source distribution package in dist/."
|
||||||
@echo " rpm: create an RPM package"
|
@echo " rpm: Create an RPM package."
|
||||||
@echo " changelog: Add a changelog entry to gwebu-profile.spec.in"
|
@echo " podman_rpm Create an RPM package using podman on MacOS."
|
||||||
|
@echo " changelog: Add a changelog entry to gwebu-profile.spec.in."
|
||||||
@echo
|
@echo
|
||||||
@echo " clean: clean all generated files"
|
@echo " clean: Clean all generated files."
|
||||||
@echo
|
@echo
|
||||||
@echo "Version $(ver), rpm_ver=$(rpm_ver), rpm_rev=$(rpm_rev)."
|
@echo "Version $(ver), rpm_ver=$(rpm_ver), rpm_rev=$(rpm_rev)."
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
@ -47,3 +48,14 @@ changelog:
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: podman_rpm
|
||||||
|
podman_rpm:
|
||||||
|
podman buildx build -t podman_rpm_build -f Dockerfile-build . # --platform linux/amd64
|
||||||
|
# Extract the RPMs from the container to ./dist/ locally.
|
||||||
|
if ! test -d dist; then mkdir dist; fi
|
||||||
|
podman run --rm -d --name=build localhost/podman_rpm_build /usr/bin/bash -c "trap : TERM INT; sleep infinity & wait"
|
||||||
|
podman cp build:/tmp/RPMS/. ./dist/
|
||||||
|
podman stop build
|
||||||
|
podman image rm localhost/podman_rpm_build
|
||||||
|
|
|
||||||
40
build.sh
Executable file
40
build.sh
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
shopt -s nullglob dotglob
|
||||||
|
|
||||||
|
if [ "$(uname -s)" != "Linux" ]; then echo "This script only works on Linux!" >&2; exit 254; fi
|
||||||
|
set -x # debug
|
||||||
|
|
||||||
|
. /etc/os-release
|
||||||
|
ARCH="${ARCH:-$(uname -m)}" #
|
||||||
|
VER="${VER:-${VERSION_ID%%\.*}}" # 8
|
||||||
|
DIST_PRE="${PLATFORM_ID##*:}" # el8
|
||||||
|
DIST="${DIST:-${DIST_PRE%%[0-9]*}}" # el
|
||||||
|
OUT_DIR="/tmp/RPMS"
|
||||||
|
|
||||||
|
export LANG='en_US.UTF-8'
|
||||||
|
export LANGUAGE="${LANG}"
|
||||||
|
export LC_ALL="${LANG}"
|
||||||
|
export LC_MEASUREMENT="${LANG}"
|
||||||
|
export LC_MONETARY="${LANG}"
|
||||||
|
export LC_NUMERIC="${LANG}"
|
||||||
|
export LC_TIME="${LANG}"
|
||||||
|
|
||||||
|
rm -rf "$OUT_DIR"
|
||||||
|
mkdir "$OUT_DIR"
|
||||||
|
|
||||||
|
#spectool -g ./*.spec
|
||||||
|
#
|
||||||
|
#if [ "$UID" == "0" ]; then
|
||||||
|
# dnf builddep -y --refresh ./*.spec
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# make rpmsrc
|
||||||
|
rpmbuild -ta ./dist/*.tar.xz \
|
||||||
|
--define "_sourcedir $PWD/dist" \
|
||||||
|
--define "_srcrpmdir $OUT_DIR" \
|
||||||
|
--define "_rpmdir $OUT_DIR" \
|
||||||
|
|
||||||
|
mv "$OUT_DIR"/*/*.rpm "$OUT_DIR/"
|
||||||
|
rmdir "$OUT_DIR"/* 2>/dev/null || true
|
||||||
12
changelog.sh
12
changelog.sh
|
|
@ -8,15 +8,15 @@ rpm_ver="${ver%%-*}"
|
||||||
rpm_rev="${ver#*-}"
|
rpm_rev="${ver#*-}"
|
||||||
rpm_numeric_rev="${rpm_rev%%-*}"
|
rpm_numeric_rev="${rpm_rev%%-*}"
|
||||||
|
|
||||||
change="* $(date +'%a %b %d %Y') $(git log -1 --format='%aN <%aE>') - ${rpm_ver}-${rpm_numeric_rev}
|
change1="* $(date +'%a %b %d %Y') $(git log -1 --format='%aN <%aE>') - ${rpm_ver}-${rpm_numeric_rev}"
|
||||||
- $(git log -1 --format=%s)
|
change2="- $(git log -1 --format=%s)"
|
||||||
"
|
|
||||||
|
|
||||||
awk -v change="${change}" '/^%changelog/ {print; print change; next} 1' gwebu-profile.spec.in \
|
awk -v change1="${change1}" -v change2="${change2}" '/^%changelog/ {print; print change1; print change2; print ""; next} 1' gwebu-profile.spec.in \
|
||||||
> gwebu-profile.spec.tmp && mv gwebu-profile.spec.tmp gwebu-profile.spec.in
|
> gwebu-profile.spec.tmp && mv gwebu-profile.spec.tmp gwebu-profile.spec.in
|
||||||
|
|
||||||
sed -i "s/Version: .*/Version: ${rpm_ver}/" gwebu-profile.spec.in
|
sed -i.bak "s/Version: .*/Version: ${rpm_ver}/" gwebu-profile.spec.in
|
||||||
sed -i "s/Release: .*/Release: ${rpm_numeric_rev}/" gwebu-profile.spec.in
|
sed -i.bak "s/Release: .*/Release: ${rpm_numeric_rev}/" gwebu-profile.spec.in
|
||||||
|
rm -f gwebu-profile.spec.in.bak
|
||||||
|
|
||||||
git add gwebu-profile.spec.in
|
git add gwebu-profile.spec.in
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,19 @@ function prompt_command() {
|
||||||
my_PWD="${PWD}"
|
my_PWD="${PWD}"
|
||||||
# Add all the accessories below ...
|
# Add all the accessories below ...
|
||||||
my_D="$(date '+%Y-%m-%d %H:%M:%S')"
|
my_D="$(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
# This is for string size calculations only.
|
# This is for string size calculations only. The variable my_P is set, see PROMPT_COMMAND below.
|
||||||
local prompt="--($my_D, Err ${my_P[*]}, $my_TTY)---($PWD)--"
|
local prompt="--($my_D, Err ${my_P[*]}, $my_TTY)---($PWD)--"
|
||||||
|
|
||||||
|
if [ -n "${VIRTUAL_ENV:-}" ] && [ -n "$_OLD_VIRTUAL_PS1" ]; then
|
||||||
|
export my_VENV="${VIRTUAL_ENV##*/}"
|
||||||
|
prompt="--($my_D, Err ${my_P[*]}, $my_TTY, $my_VENV)---($PWD)--"
|
||||||
|
if [ "${PS1:0:${#my_VENV}+3}" == "($my_VENV) " ]; then
|
||||||
|
# PS1 will be restored by virtual environment's deactivate script.
|
||||||
|
# Yeah, that has to be done better, 172 is correct but magic number.
|
||||||
|
export PS1="${_OLD_VIRTUAL_PS1:0:172}, ${my_VENV}${_OLD_VIRTUAL_PS1:172}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
local fill_size=0
|
local fill_size=0
|
||||||
[ -z "${COLUMNS}" ] && COLUMNS=$(tput cols)
|
[ -z "${COLUMNS}" ] && COLUMNS=$(tput cols)
|
||||||
((fill_size=COLUMNS-${#prompt}))
|
((fill_size=COLUMNS-${#prompt}))
|
||||||
|
|
@ -157,7 +168,7 @@ ${C1}\${USER}${C2}@${C1}\${HOSTNAME%%.*}\
|
||||||
${C2})${C3}\$${NO_COLOUR} "
|
${C2})${C3}\$${NO_COLOUR} "
|
||||||
|
|
||||||
export PS2="${C2}─${C1}─${C1}─${NO_COLOUR} \[\033[K\]"
|
export PS2="${C2}─${C1}─${C1}─${NO_COLOUR} \[\033[K\]"
|
||||||
|
# Set my_P to the exit codes of the last command pipe.
|
||||||
local P='my_P=("${PIPESTATUS[@]}");prompt_command'
|
local P='my_P=("${PIPESTATUS[@]}");prompt_command'
|
||||||
if declare -p PROMPT_COMMAND &>/dev/null; then
|
if declare -p PROMPT_COMMAND &>/dev/null; then
|
||||||
local re='^declare -a '
|
local re='^declare -a '
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Summary: Gwebu profile.d - cool date, prompt with history, aliases
|
Summary: Gwebu profile.d - cool date, prompt with history, aliases
|
||||||
Name: gwebu-profile
|
Name: gwebu-profile
|
||||||
Version: 1.0.2
|
Version: 1.0.3
|
||||||
Release: 6
|
Release: 2
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Source0: profile.d-%{version}-%{release}.tar.xz
|
Source0: profile.d-%{version}-%{release}.tar.xz
|
||||||
|
|
@ -41,10 +41,15 @@ install -m 0644 etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d/
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu May 30 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-6
|
* Mon Jul 15 2024 Doncho Gunchev <doncho.gunchev@flyrlabs.com> - 1.0.3-2
|
||||||
- New shebang for changelog.sh, post-commit hook in README.md.
|
- Fix python virtual environment support.
|
||||||
|
This works on MacOS with python 3.9, 3.10, 3.11 and 3.12.
|
||||||
|
|
||||||
|
* Sun Jul 14 2024 Doncho Gunchev <doncho.gunchev@flyrlabs.com> - 1.0.3-0
|
||||||
|
- Initial python virtual environment support.
|
||||||
|
|
||||||
* Thu May 30 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-6
|
* Thu May 30 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-6
|
||||||
|
- New shebang for changelog.sh, post-commit hook in README.md.
|
||||||
|
|
||||||
* Thu May 30 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-5
|
* Thu May 30 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-5
|
||||||
- Add ssh control masters management aliases. Silence a which.
|
- Add ssh control masters management aliases. Silence a which.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue