Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.0 #3

Merged
merged 8 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
50 changes: 50 additions & 0 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Build RPM
name: Build RPM Package

on:
push:
branches:
- 'release/*'

jobs:
build:
runs-on: ubuntu-latest
env:
RPM_VERSION: ${{ steps.set_vars.outputs.rpm_version }}
RPM_RELEASE: ${{ steps.set_vars.outputs.rpm_release }}
TAR_VERSION: ${{ steps.set_vars.outputs.tar_version }}

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Variables
id: set_vars
run: |
echo "::set-output name=rpm_version::$(echo "${{ github.ref }}" | sed 's|refs/heads/release/||')"
echo "::set-output name=rpm_release::$(git rev-parse --short=8 HEAD)"
echo "::set-output name=tar_version::${{ steps.set_vars.outputs.rpm_version }}-${{ steps.set_vars.outputs.rpm_release }}"

- name: Prepare Source
run: |
TAR_NAME="bash-tui-${{ env.TAR_VERSION }}.tar.gz"
mkdir -p $HOME/rpmbuild/SOURCES
tar czf $HOME/rpmbuild/SOURCES/$TAR_NAME --exclude=.git .

- name: Build RPM
run: |
rpmbuild -ba bash-tui.spec \
--define "_sourcedir $HOME/rpmbuild/SOURCES" \
--define "tar_version $TAR_VERSION" \
--define "rpm_version $RPM_VERSION" \
--define "rpm_release $RPM_RELEASE" \
--define "_srcrpmdir $HOME" \
--define "_rpmdir $HOME"

- name: Upload RPM
uses: actions/upload-artifact@v2
with:
name: bash-tui
path: |
${HOME}/*.rpm

47 changes: 47 additions & 0 deletions bash-tui.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Name: bash-tui
Version: %{?rpm_version}
Release: %{?rpm_release}
Summary: Bash TUI project

License: GPL
URL: /~https://github.com/yourusername/bash-tui
Source0: bash-tui-%{tar_version}.tar.gz

BuildRequires: git, rpm-build
Requires: bash

%description
Bash TUI project for improved shell interface.

%prep
%setup -q -n dir_root

%build
# Add build commands here (if any)

%install
mkdir -p %{buildroot}

cp -a * %{buildroot}/

%files
%defattr(-,root,root,-)
/etc/bash-tui-colors.conf
/etc/bash-tui.conf
/etc/profile.d/00_custom_colors.sh
/etc/profile.d/01_custom_vars.sh
/etc/profile.d/20_rosterlib.sh
/etc/profile.d/10_aliases.sh
/etc/profile.d/99_commandline.sh
/usr/bin/bash-tui/harper
/usr/bin/bash-tui/ldd2tar
/usr/bin/bash-tui/netspeed
/usr/lib/bash-tui/custom_functions.sh
/usr/lib/bash-tui/svnlocal.sh
/usr/lib/bash-tui/say.sh
/usr/lib/bash-tui/bashparms.sh

%changelog
* Sat Feb 17 19:23:58 PST 2024 Matteo Bignotti <gugoll@gmail.com> - 1.0
- First release of bash-tui RPM

7 changes: 4 additions & 3 deletions dir_root/etc/bash-tui.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

## This is the configuration file for bash-tui

## IF you want to disable the default PS1 just comment BASHTUI_cline_repo_ENABLED and declare -a BTUI
## Enable command-line repo helper
# default: false
#BASHTUI_cline_repo_ENABLED=true
# default: true
BASHTUI_cline_repo_ENABLED=true

## Composing BASH-TUI
## Obviously the bottom line is the current one.
#declare -a BTUI
declare -a BTUI

## Declaration
BASHTUI_PS1=
Expand Down
2 changes: 1 addition & 1 deletion dir_root/etc/profile.d/99_commandline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare -A cline_REPO_COLORLIVE
## GIT: You can create custom methods
cline_GRACEFUL[GIT]="/usr/bin/git rev-parse --is-inside-work-tree &>/dev/null 2>&1"
cline_REMOTE[GIT]="/usr/bin/git remote -v | grep '^origin' | tail -1 | awk '{print \$2}'"
cline_GET[GIT]="/usr/bin/git branch -a | grep '^*' | sed 's|^*[[:space:]]*||g'"
cline_GET[GIT]="/usr/bin/git rev-parse --abbrev-ref HEAD"

cline_REPO_PATTERN[GIT]="[%s]\n"
cline_REPO_COLOR[GIT]=$dred
Expand Down
13 changes: 11 additions & 2 deletions dir_root/usr/lib/bash-tui/say.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ _L_hor_=
# l => Log Level : read up on _L_l_
function say()
{
[ -z ${_L_l_} ] && echo -e "$1" && return 0 #- Okay... geee...
[ -z "${_L_l_}" ] && echo -e "$1" && return 0 #- Okay... geee...
# This works with BASH-TUI
[ -z ${BTUI_n} ] && [ -e $BTUI_cache ] && . $BTUI_cache
[ -z "${BTUI_n}" ] && [ -n "$BTUI_cache" ] && [ -e "$BTUI_cache" ] && . "$BTUI_cache"
#Default
local x= # Control variable
local c= # El Colore
local s="${_L_hor_}" # Signal/Log level
local l=10 #- info
local b="[$(date '+%Y-%m-%d %H:%M:%S')]" #- What the log looks like
local m=$1
local doexit=0
# Parameters
if [ ! -z "${2}" ];then
if [ "${2}" = "debug" ]; then
Expand All @@ -61,6 +62,12 @@ function say()
c=${red}
s=ERROR
x=1
elif [ "${2}" = "exit" ]; then
l=0
c=${red}
s=ERROR
x=1
doexit=1
elif [ "${2}" = "warning" ]; then
l=20
c=${yellow}
Expand Down Expand Up @@ -132,6 +139,8 @@ function say()
# Logging
echo -e "${b} ${m}" >> "${_L_dir_}/${_L_file_}"

(($doexit)) && exit 1
return 0
}

say_clean()
Expand Down