- Base library:
- Rename default.bash to base.bash,
- Normalise some function names: version_print(), help_print(), str_quote(), str_escape(), echo_line(), echo_error() & cmd_exec()
- Normalise some global variables: VERBOSE & DRY_RUN,
- Add default options: errexit, pipefail & nounset,
- Add GPL headers,
- ISL:
- Move ISL functions to isl command,
- Add bash completion,
- URPMI-Setup:
- Add urpmi-setup command.
This commit is contained in:
1
COPYING.LESSER
Symbolic link
1
COPYING.LESSER
Symbolic link
@@ -0,0 +1 @@
|
||||
GNU_LGPL-3.0.txt
|
||||
165
GNU_LGPL-3.0.txt
Normal file
165
GNU_LGPL-3.0.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
12
ReadMe.txt
12
ReadMe.txt
@@ -1,11 +1,7 @@
|
||||
Welcome to Rx3 Base 1.0.x !
|
||||
Welcome to Rx3 Base 1.1.x !
|
||||
|
||||
|
||||
|
||||
Base is licensed under the GPL GNU Licenses.
|
||||
For more information, please read the corresponding source file headers.
|
||||
The license details can be found in the GNU-GPL.txt and GNU-FDL.txt files.
|
||||
|
||||
This is the base component of an Rx3 system:
|
||||
- Default config files,
|
||||
- Base bash libraries,
|
||||
@@ -13,6 +9,12 @@ This is the base component of an Rx3 system:
|
||||
|
||||
|
||||
|
||||
Rx3 Base is licensed under the LGPL/GPL GNU Licenses.
|
||||
For more information, please read the corresponding source file headers.
|
||||
The license details can be found in the GNU-GPL.txt, GNU-LGPL.txt and GNU-FDL.txt files.
|
||||
|
||||
|
||||
|
||||
Enjoy it!
|
||||
|
||||
Your Rx3 Team.
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Base V 1.1.0 - A. GIBERT - 2026/04/06
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Base library:
|
||||
- Rename default.bash to base.bash,
|
||||
- Normalise some function names: version_print(), help_print(), str_quote(), str_escape(), echo_line(), echo_error() & cmd_exec()
|
||||
- Normalise some global variables: VERBOSE & DRY_RUN,
|
||||
- Add default options: errexit, pipefail & nounset,
|
||||
- Add GPL headers,
|
||||
- ISL:
|
||||
- Move ISL functions to isl command,
|
||||
- Add bash completion,
|
||||
- URPMI-Setup:
|
||||
- Add urpmi-setup command.
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Base V 1.0.0 - A. GIBERT - 2026/03/17
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,6 +1,31 @@
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Rx3 Base
|
||||
#
|
||||
# Copyright (C) 2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
%define name rx3-base
|
||||
|
||||
%define version 1.0.0
|
||||
%define version 1.1.0
|
||||
%define release %mkrel 1rx3
|
||||
|
||||
|
||||
@@ -69,11 +94,17 @@ This is the base component of an Rx3 system:
|
||||
# Config
|
||||
%{__mkdir_p} %{buildroot}%{_sysconfdir}/profile.d
|
||||
cp etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d
|
||||
%{__mkdir_p} %{buildroot}%{_sysconfdir}/bash_completion.d
|
||||
cp etc/bash_completion.d/* %{buildroot}%{_sysconfdir}/bash_completion.d
|
||||
|
||||
# Libs
|
||||
%{__mkdir_p} %{buildroot}%{_prefix}/lib/rx3
|
||||
cp usr/lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
|
||||
|
||||
# Bin
|
||||
%{__mkdir_p} %{buildroot}%{_sbindir}
|
||||
cp sbin/* %{buildroot}%{_sbindir}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -83,11 +114,13 @@ cp usr/lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
%files
|
||||
%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
|
||||
%license GNU_GPL-3.0.txt GNU_FDL-1.3.txt
|
||||
%doc ReadMe.txt ReleaseNotes.txt ToDo.txt
|
||||
%license COPYING COPYING.LESSER GNU_GPL-3.0.txt GNU_LGPL-3.0.txt GNU_FDL-1.3.txt
|
||||
%defattr(644,root,root)
|
||||
%{_sysconfdir}/profile.d/*
|
||||
%{_prefix}/lib/rx3/*
|
||||
%{_sysconfdir}/profile.d/*
|
||||
%{_sysconfdir}/bash_completion.d/*
|
||||
%{_prefix}/lib/rx3/*
|
||||
%attr(0755,root,root) %{_sbindir}/*
|
||||
|
||||
|
||||
|
||||
@@ -98,5 +131,8 @@ cp usr/lib/rx3/*.bash %{buildroot}%{_prefix}/lib/rx3
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
%changelog
|
||||
* Mon Apr 6 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.1.0-1rx3.mga9
|
||||
- Update to 1.1.0
|
||||
|
||||
* Tue Mar 17 2026 Arnaud G. GIBERT <arnaud@rx3.net> - 1.0.0-1rx3.mga9
|
||||
- Initial release
|
||||
|
||||
63
etc/bash_completion.d/isl
Normal file
63
etc/bash_completion.d/isl
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# ISL: Image Stack Log
|
||||
#
|
||||
# Copyright (C) 2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# -*- mode: shell; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
|
||||
|
||||
|
||||
|
||||
_isl() {
|
||||
local cur prev opts sub_opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="--help -h --version -V --test -T --verbose -v --add -a --cat -c --dump -d --top -t"
|
||||
sub_opts="--reverse -r --inline -i --image -m"
|
||||
|
||||
# Check if we're completing a sub-option
|
||||
case "${COMP_WORDS[1]}" in
|
||||
--cat|-c|--dump|-d|--top|-t)
|
||||
COMPREPLY=( $(compgen -W "${sub_opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Top-level completion
|
||||
case "${prev}" in
|
||||
--add|-a)
|
||||
COMPREPLY=( $(compgen -f -- "${cur}") ) # Complete with filenames/URLs
|
||||
return 0
|
||||
;;
|
||||
--cat|-c|--dump|-d|--top|-t)
|
||||
COMPREPLY=( $(compgen -W "${sub_opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
complete -F _isl isl
|
||||
98
etc/bash_completion.d/urpmi-setup
Normal file
98
etc/bash_completion.d/urpmi-setup
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# URPMI Setup
|
||||
#
|
||||
# Copyright (C) 2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# -*- mode: shell; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
|
||||
|
||||
|
||||
|
||||
_urpmi_setup() {
|
||||
local cur prev opts distrib_opts mirror_opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Supported distributions (customize as needed)
|
||||
distrib_opts="9 10 cauldron"
|
||||
|
||||
# Example mirror lists (customize as needed)
|
||||
mirror_opts_mga="https://mirror.rx3.net/mageia/distrib/${DISTRIB}/x86_64 ftp://ftp.proxad.net/mirrors/mageia.org/distrib/${DISTRIB}/x86_64"
|
||||
mirror_opts_rx3="http://mirror.xor.rx3/rx3/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/rx3/distrib/${DISTRIB}/x86_64"
|
||||
|
||||
# Check if --help or --version is already used
|
||||
local has_help_or_version=false
|
||||
local has_dmr=false # -d, -m, or -r
|
||||
|
||||
for arg in "${COMP_WORDS[@]}"; do
|
||||
case "$arg" in
|
||||
--help|-h|--version|-V)
|
||||
has_help_or_version=true
|
||||
;;
|
||||
|
||||
--distrib|-d|--mirror-mga|-m|--mirror-rx3|-r)
|
||||
has_dmr=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If --help or --version is used, only suggest -v, -T, and -u
|
||||
if $has_help_or_version; then
|
||||
opts="--test -T --update -u --verbose -v"
|
||||
# If -d, -m, or -r is used, exclude --help and --version
|
||||
elif $has_dmr; then
|
||||
opts="--test -T --update -u --verbose -v --distrib -d --mirror-mga -m --mirror-rx3 -r"
|
||||
# Otherwise, show all options
|
||||
else
|
||||
opts="--help -h --version -V --distrib -d --mirror-mga -m --mirror-rx3 -r --test -T --update -u --verbose -v"
|
||||
fi
|
||||
|
||||
case "${prev}" in
|
||||
--distrib|-d)
|
||||
COMPREPLY=( $(compgen -W "${distrib_opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
|
||||
--mirror-mga|-m)
|
||||
COMPREPLY=( $(compgen -W "${mirror_opts_mga}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
|
||||
--mirror-rx3|-r)
|
||||
COMPREPLY=( $(compgen -W "${mirror_opts_rx3}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
|
||||
--mirror-mga|-m|--mirror-rx3|-r)
|
||||
COMPREPLY=( $(compgen -W "${mirror_opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
complete -F _urpmi_setup urpmi-setup
|
||||
@@ -1,5 +1,29 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Rx3 Base Profile
|
||||
#
|
||||
# Copyright (C) 2000-2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Global Variable
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -11,6 +35,7 @@ export EDITOR=emacs
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# CatVal
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -29,29 +54,7 @@ export -f cateval
|
||||
|
||||
|
||||
|
||||
# Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
print()
|
||||
{
|
||||
if [[ "$1" == "-i" ]]
|
||||
then
|
||||
shift
|
||||
|
||||
str="%s"'\\n'
|
||||
else
|
||||
str="%s"'\n'
|
||||
fi
|
||||
|
||||
printf "${str}" "$*"
|
||||
}
|
||||
|
||||
export -f print
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# File Enable
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -81,15 +84,17 @@ export -f file_enable
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Include
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
. /usr/lib/rx3/isl.bash
|
||||
# None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Aliases
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
384
sbin/isl
Executable file
384
sbin/isl
Executable file
@@ -0,0 +1,384 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# ISL: Image Stack Log
|
||||
#
|
||||
# Copyright (C) 2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Includes
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
. /usr/lib/rx3/base.bash
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Global Variables
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
declare -g VERSION="1.1.0"
|
||||
declare -g NAME="ISL"
|
||||
declare -g HELP="usage: isl [-a | --add <URL>] | [-c | --cat [-r | --reverse]] | [-d | --dump [-i | --inline] [-r | --reverse]] | [-t | --top [-m | --image]] | [[-h | --help] | [-V | --version] [-T | --test] [-v | --verbose]"
|
||||
|
||||
declare -g ISL_FILE="/etc/img_stack_log"
|
||||
declare -g EXIT_CODE=0
|
||||
declare -g MODE="DEFAULT"
|
||||
declare -g IMAGE="FALSE"
|
||||
declare -g INLINE="FALSE"
|
||||
declare -g REVERSE="FALSE"
|
||||
declare -g URL=""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Arg Parse
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function isl_args_parse()
|
||||
{
|
||||
tmp_args=$(getopt -o a:cdhtVimrTv --long add:,cat,dump,help,top,version,image,inline,reverse,test,verbose -- "$@")
|
||||
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
|
||||
# Note the quotes around `$tmp_args': they are essential!
|
||||
eval set -- "${tmp_args}"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
|
||||
# Options
|
||||
-i|--inline) INLINE="TRUE"; shift;;
|
||||
-m|--image) IMAGE="TRUE"; shift;;
|
||||
-r|--reverse) REVERSE="TRUE"; shift;;
|
||||
|
||||
# Mode switches
|
||||
-a|--add) MODE="ADD"; shift; URL="$1"; shift;;
|
||||
-c|--cat) MODE="CAT"; shift;;
|
||||
-d|--dump) MODE="DUMP"; shift;;
|
||||
-h|--help) MODE="HELP"; shift;;
|
||||
-t|--top) MODE="TOP"; shift;;
|
||||
-V|--version) MODE="VERSION"; shift;;
|
||||
|
||||
# Global options
|
||||
-T|--test) DRY_RUN="TRUE"; shift;;
|
||||
-v|--verbose) VERBOSE="TRUE"; shift;;
|
||||
|
||||
#
|
||||
--) shift; break;;
|
||||
*) echo "args_parse internal error [$1] !"; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${MODE}" == "DEFAULT" ]]
|
||||
then
|
||||
echo_error "A mode should be selected!"
|
||||
MODE="HELP"
|
||||
EXIT_CODE=1
|
||||
else
|
||||
if [[ "${REVERSE}" == "TRUE" ]]
|
||||
then
|
||||
if [[ ( "${MODE}" != "CAT") && ( "${MODE}" != "DUMP") ]]
|
||||
then
|
||||
echo_error "Reverse option only valid in Cat or Dump mode!"
|
||||
MODE="HELP"
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ( "${INLINE}" == "TRUE") && ( "${MODE}" != "DUMP") ]]
|
||||
then
|
||||
echo_error "Inline option only valid in Dump mode!"
|
||||
MODE="HELP"
|
||||
EXIT_CODE=1
|
||||
else
|
||||
if [[ ( "${IMAGE}" == "TRUE") && ( "${MODE}" != "TOP") ]]
|
||||
then
|
||||
echo_error "Image option only valid in Top mode!"
|
||||
MODE="HELP"
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Version Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_version_print()
|
||||
{
|
||||
version_print
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Help Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_help_print()
|
||||
{
|
||||
version_print
|
||||
help_print
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_print()
|
||||
{
|
||||
local inline="$1"
|
||||
|
||||
|
||||
if [[ "${inline}" == "TRUE" ]]
|
||||
then
|
||||
shift
|
||||
|
||||
str="%s"'\\n'
|
||||
else
|
||||
str="%s"'\n'
|
||||
fi
|
||||
|
||||
printf "${str}" "$*"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Add
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_add()
|
||||
{
|
||||
local url="$1"
|
||||
|
||||
|
||||
reg=${url%%/*}
|
||||
|
||||
if [[ "${reg}" == *.* ]]
|
||||
then
|
||||
url=${url#*/}
|
||||
else
|
||||
reg="-"
|
||||
fi
|
||||
|
||||
tag=${url/*:}
|
||||
name=${url%:*}
|
||||
|
||||
if [[ "${tag}" == "${name}" ]]
|
||||
then
|
||||
echo "Bad tag format in URL!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ts=$(date -u +"%Y/%m/%d %H:%M:%S")
|
||||
|
||||
if [[ ! -e ${ISL_FILE} ]]
|
||||
then
|
||||
id=1
|
||||
else
|
||||
id=$(( $(wc -l <${ISL_FILE}) + 1))
|
||||
fi
|
||||
|
||||
str="${id} ${ts} ${reg} ${name} ${tag}"
|
||||
|
||||
if [[ $id == "1" ]]
|
||||
then
|
||||
echo "${str}" >${ISL_FILE}
|
||||
else
|
||||
sed -i '1i\'"${str}" ${ISL_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Cat
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_cat()
|
||||
{
|
||||
local reverse="$1"
|
||||
|
||||
|
||||
if [[ "${reverse}" == "TRUE" ]]
|
||||
then
|
||||
tac ${ISL_FILE}
|
||||
else
|
||||
cat ${ISL_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL HTML Dump
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_html_dump()
|
||||
{
|
||||
local reverse="$1"
|
||||
local inline="$2"
|
||||
|
||||
local i=1
|
||||
local j=1
|
||||
|
||||
|
||||
i=1
|
||||
|
||||
isl_cat "${reverse}" | while read line
|
||||
do
|
||||
set $line
|
||||
|
||||
if [[ $(( $i % 2)) -eq 0 ]]
|
||||
then
|
||||
isl_print "${inline}" ' <tr class="shade">'
|
||||
else
|
||||
isl_print "${inline}" " <tr>"
|
||||
fi
|
||||
|
||||
j=1
|
||||
while [[ $j -lt 7 ]]
|
||||
do
|
||||
if [[ "$j" == "1" ]]
|
||||
then
|
||||
isl_print "${inline}" " <th>${!j}</th>"
|
||||
else
|
||||
isl_print "${inline}" " <td>${!j}</td>"
|
||||
fi
|
||||
|
||||
j=$(( $j + 1))
|
||||
done
|
||||
|
||||
isl_print "${inline}" " </tr>"
|
||||
i=$(( $i + 1))
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL Top
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_top()
|
||||
{
|
||||
local image="$1"
|
||||
local line=""
|
||||
|
||||
line=$( head -1 ${ISL_FILE})
|
||||
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
if [[ "${image}" == "TRUE" ]]
|
||||
then
|
||||
set ${line}
|
||||
|
||||
echo "$5:$6"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Main
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
orig_args=("$@")
|
||||
|
||||
isl_args_parse "$@"
|
||||
|
||||
|
||||
case "${MODE}" in
|
||||
|
||||
"EXIT")
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
|
||||
"HELP")
|
||||
isl_help_print
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
|
||||
"VERSION")
|
||||
isl_version_print
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
echo_error "ISL: Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] URL: [${URL}] Image: [${IMAGE}] Inline: [${INLINE}] Reverse: [${REVERSE}]"
|
||||
|
||||
|
||||
|
||||
case "${MODE}" in
|
||||
"ADD")
|
||||
isl_add "${URL}"
|
||||
;;
|
||||
|
||||
"CAT")
|
||||
isl_cat "${REVERSE}"
|
||||
;;
|
||||
|
||||
"DUMP")
|
||||
isl_dump "${REVERSE}" "${INLINE}"
|
||||
;;
|
||||
|
||||
"TOP")
|
||||
isl_top "${IMAGE}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
exit ${EXIT_CODE}
|
||||
197
sbin/urpmi-setup
Executable file
197
sbin/urpmi-setup
Executable file
@@ -0,0 +1,197 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# URPMI Setup
|
||||
#
|
||||
# Copyright (C) 2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Includes
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
. /usr/lib/rx3/base.bash
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Global Variables
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
declare -g VERSION="1.0.0"
|
||||
declare -g NAME="URPMI Setup"
|
||||
declare -g HELP="usage: urpmi-setup [ [-d | --distrib <Distrib>] [-m | --mirror-mga <Mirror_List>] [-r | --mirror-rx3 <Mirror_List>] ] | [-h | --help] | [-V | --version] [-T | --test] [-u | --update] [-v | --verbose]"
|
||||
|
||||
declare -g DISTRIB_DEF="9"
|
||||
declare -g MIRRORLIST_MGA_DEF='http://mirror.xor.rx3/mageia/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/mageia/distrib/${DISTRIB}/x86_64 ftp://ftp.proxad.net/mirrors/mageia.org/distrib/${DISTRIB}/x86_64 http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/${DISTRIB}/x86_64'
|
||||
declare -g MIRRORLIST_RX3_DEF='http://mirror.xor.rx3/rx3/distrib/${DISTRIB}/x86_64 https://mirror.rx3.net/rx3/distrib/${DISTRIB}/x86_64'
|
||||
|
||||
declare -g EXIT_CODE=0
|
||||
declare -g MODE="DEFAULT"
|
||||
declare -g DISTRIB=""
|
||||
declare -g MIRRORLIST_MGA=""
|
||||
declare -g MIRRORLIST_RX3=""
|
||||
declare -g UPDATE="FALSE"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# US Arg Parse
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function us_args_parse()
|
||||
{
|
||||
tmp_args=$(getopt -o d:hm:r:Tuv --long distrib:,help,mirror-mga:,mirror-rx3:,test,update,verbose -- "$@")
|
||||
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
|
||||
# Note the quotes around `$tmp_args': they are essential!
|
||||
eval set -- "${tmp_args}"
|
||||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
|
||||
# Options
|
||||
-d|--distrib) shift; DISTRIB="$1"; shift;;
|
||||
-m|--mirror-mga) shift; MIRRORLIST_MGA="$1"; shift;;
|
||||
-r|--mirror-rx3) shift; MIRRORLIST_RX3="$1"; shift;;
|
||||
|
||||
# Mode switches
|
||||
-h|--help) MODE="HELP"; shift;;
|
||||
-V|--version) MODE="VERSION"; shift;;
|
||||
|
||||
# Global options
|
||||
-T|--test) DRY_RUN="TRUE"; shift;;
|
||||
-u|--update) UPDATE="TRUE"; shift;;
|
||||
-v|--verbose) VERBOSE="TRUE"; shift;;
|
||||
|
||||
#
|
||||
--) shift; break;;
|
||||
*) echo "args_parse internal error [$1] !"; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${DISTRIB} == "" ]]
|
||||
then
|
||||
DISTRIB=${DISTRIB_DEF}
|
||||
fi
|
||||
|
||||
if [[ "${MIRRORLIST_MGA}" == "" ]]
|
||||
then
|
||||
eval MIRRORLIST_MGA=\"${MIRRORLIST_MGA_DEF}\"
|
||||
fi
|
||||
|
||||
if [[ "${MIRRORLIST_RX3}" == "" ]]
|
||||
then
|
||||
eval MIRRORLIST_RX3=\"${MIRRORLIST_RX3_DEF}\"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# US Version Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
us_version_print()
|
||||
{
|
||||
version_print
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# US Help Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
us_help_print()
|
||||
{
|
||||
version_print
|
||||
help_print
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Main
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
orig_args=("$@")
|
||||
|
||||
us_args_parse "$@"
|
||||
|
||||
|
||||
case "${MODE}" in
|
||||
|
||||
"EXIT")
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
|
||||
"HELP")
|
||||
us_help_print
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
|
||||
"VERSION")
|
||||
us_version_print
|
||||
exit ${EXIT_CODE}
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
echo_error "${NAME}: Mode: [${MODE}] Verbose: [${VERBOSE}] Dry_Run: [${DRY_RUN}] Distrib: [${DISTRIB}] MirrorList_MGA: [${MIRRORLIST_MGA}] MirrorList_RX3: [${MIRRORLIST_RX3}] Update: [${UPDATE}]"
|
||||
|
||||
cmd_exec 'urpmi.removemedia -a'
|
||||
cmd_exec 'rm -f /var/cache/urpmi/mirrors.cache'
|
||||
cmd_exec 'urpmi.addmedia --distrib --mirrorlist "'"${MIRRORLIST_MGA}"'"'
|
||||
cmd_exec 'urpmi.addmedia --distrib --mirrorlist "'"${MIRRORLIST_RX3}"'"'
|
||||
|
||||
for arch in "" "32bit "
|
||||
do
|
||||
for media in "Core" "Nonfree" "Tainted"
|
||||
do
|
||||
for type in "Release" "Updates"
|
||||
do
|
||||
cmd_exec 'urpmi.update --no-ignore "'"${media}"' '"${arch}""${type}"'"'
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
cmd_exec 'urpmi.update -a'
|
||||
|
||||
if [[ "${UPDATE}" == "TRUE" ]]
|
||||
then
|
||||
cmd_exec 'urpmi --force --auto-update'
|
||||
fi
|
||||
|
||||
exit ${EXIT_CODE}
|
||||
@@ -1,4 +1,26 @@
|
||||
#!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Rx3 Bash Base Library
|
||||
#
|
||||
# Copyright (C) 2017-2026 Arnaud G. GIBERT
|
||||
# mailto:arnaud@rx3.net
|
||||
#
|
||||
# This is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser 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 Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if [[ "${DEFAULT_BASH}" != "" ]]
|
||||
then
|
||||
@@ -9,69 +31,84 @@ fi
|
||||
|
||||
|
||||
|
||||
# Global Variable
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
declare -g LOG_FILE=""
|
||||
declare -g LOG_LOCK=""
|
||||
declare -g LOG_ECHO=""
|
||||
declare -g LOG_TRACE="DISABLED"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default Options
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
set -o errexit -o pipefail -o nounset
|
||||
shopt -s extglob
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Print Version
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Global Variable
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
declare -g VERSION=""
|
||||
declare -g NAME=""
|
||||
declare -g HELP=""
|
||||
declare -g VERBOSE="FALSE"
|
||||
declare -g DRY_RUN="FALSE"
|
||||
|
||||
declare -g LOG_FILE=""
|
||||
declare -g LOG_LOCK=""
|
||||
declare -g LOG_ECHO=""
|
||||
declare -g LOG_TRACE="DISABLED"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Version Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
version_print()
|
||||
{
|
||||
echo "$VERSION" | sed -e 's/.*: //' -e 's/-/ /' -e 's/_/\./g' -e 's/\$$//'
|
||||
# echo "${VERSION}" | sed -e 's/.*: //' -e 's/-/ /' -e 's/_/\./g' -e 's/\$$//'
|
||||
echo "${NAME} V${VERSION}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Prin Help
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Help Print
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
help_print()
|
||||
{
|
||||
echo "${NAME} ${HELP}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Quote Str
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Str Quote
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
quote_str()
|
||||
str_quote()
|
||||
{
|
||||
local quoted=${1//\'/\'\\\'\'}
|
||||
printf "'%s'" "$quoted"
|
||||
|
||||
|
||||
printf "'%s'" "${quoted}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Escape Str
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Str Escape
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
escape_str()
|
||||
str_escape()
|
||||
{
|
||||
echo "$*" | sed -e "s/\"/\\\\\"/g"
|
||||
}
|
||||
@@ -80,14 +117,16 @@ escape_str()
|
||||
|
||||
|
||||
|
||||
# Line Echo
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Echo Line
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
line_echo()
|
||||
echo_line()
|
||||
{
|
||||
string="$1"
|
||||
count="$2"
|
||||
local string="$1"
|
||||
local count="$2"
|
||||
|
||||
|
||||
echo -en "\e[2K\r"
|
||||
|
||||
if [[ "${count}" != "" ]]
|
||||
@@ -101,10 +140,11 @@ line_echo()
|
||||
|
||||
|
||||
|
||||
# Err Echo
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Echo Error
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
err_echo()
|
||||
echo_error()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
@@ -113,20 +153,21 @@ err_echo()
|
||||
|
||||
|
||||
|
||||
# Exec CMD
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# Cmd Exec
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
exec_cmd()
|
||||
cmd_exec()
|
||||
{
|
||||
cmd="$1"
|
||||
local cmd="$1"
|
||||
|
||||
|
||||
if [[ "${verbose}" == "true" ]]
|
||||
if [[ "${VERBOSE}" == "TRUE" ]]
|
||||
then
|
||||
echo "${cmd}" 1>&2
|
||||
fi
|
||||
|
||||
if [[ "${dry_run}" != "true" ]]
|
||||
if [[ "${DRY_RUN}" != "TRUE" ]]
|
||||
then
|
||||
eval "${cmd}"
|
||||
fi
|
||||
@@ -136,7 +177,7 @@ exec_cmd()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# tab_assign
|
||||
# Tab Assign
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
tab_assign()
|
||||
@@ -159,7 +200,7 @@ tab_assign()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# var_assign
|
||||
# Var Assign
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
var_assign()
|
||||
@@ -187,7 +228,7 @@ var_assign()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# file_dir_init
|
||||
# File Dir Init
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
file_dir_init()
|
||||
@@ -230,7 +271,7 @@ file_dir_init()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# file_lock
|
||||
# File Lock
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
file_lock()
|
||||
@@ -267,7 +308,7 @@ file_lock()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# file_unlock
|
||||
# File Unlock
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
file_unlock()
|
||||
@@ -290,7 +331,7 @@ file_unlock()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_set
|
||||
# Log Set
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_set()
|
||||
@@ -301,14 +342,14 @@ log_set()
|
||||
local log_trace="$4"
|
||||
|
||||
|
||||
LOG_FILE="${log_file}"
|
||||
LOG_LOCK="${lock_file}"
|
||||
LOG_ECHO="${echo_function}"
|
||||
LOG_FILE="${log_file}"
|
||||
LOG_LOCK="${lock_file}"
|
||||
LOG_ECHO="${echo_function}"
|
||||
|
||||
if [[ ${log_trace} != "" ]]
|
||||
then
|
||||
LOG_TRACE="${log_trace}"
|
||||
fi
|
||||
if [[ ${log_trace} != "" ]]
|
||||
then
|
||||
LOG_TRACE="${log_trace}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +357,7 @@ log_set()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_print
|
||||
# Log Print
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_print()
|
||||
@@ -356,7 +397,7 @@ log_print()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_trace
|
||||
# Log Trace
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_trace()
|
||||
@@ -369,7 +410,7 @@ log_trace()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_info
|
||||
# Log Info
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_info()
|
||||
@@ -382,7 +423,7 @@ log_info()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_warning
|
||||
# Log Warning
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_warning()
|
||||
@@ -395,7 +436,7 @@ log_warning()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
# log_error
|
||||
# Log Error
|
||||
#--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
log_error()
|
||||
@@ -1,163 +0,0 @@
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
# ISL: Image Stack Log
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
# Global Variable
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
export ISL_FILE=/etc/img_stack_log
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ISL Add
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_add()
|
||||
{
|
||||
url="$1"
|
||||
|
||||
|
||||
reg=${url%%/*}
|
||||
|
||||
if [[ "${reg}" == *.* ]]
|
||||
then
|
||||
url=${url#*/}
|
||||
else
|
||||
reg="-"
|
||||
fi
|
||||
|
||||
tag=${url/*:}
|
||||
name=${url%:*}
|
||||
|
||||
if [[ "${tag}" == "${name}" ]]
|
||||
then
|
||||
echo "Bad tag format in URL!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ts=$(date -u +"%Y/%m/%d %H:%M:%S")
|
||||
|
||||
if [[ ! -e ${ISL_FILE} ]]
|
||||
then
|
||||
id=1
|
||||
else
|
||||
id=$(( $(wc -l <${ISL_FILE}) + 1))
|
||||
fi
|
||||
|
||||
str="${id} ${ts} ${reg} ${name} ${tag}"
|
||||
|
||||
if [[ $id == "1" ]]
|
||||
then
|
||||
echo "${str}" >${ISL_FILE}
|
||||
else
|
||||
sed -i '1i\'"${str}" ${ISL_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
export -f isl_add
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ISL Top
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_top()
|
||||
{
|
||||
line=$( head -1 ${ISL_FILE})
|
||||
|
||||
if [[ "$1" == "-i" ]]
|
||||
then
|
||||
set ${line}
|
||||
|
||||
echo "$5:$6"
|
||||
else
|
||||
echo "${line}"
|
||||
fi
|
||||
}
|
||||
|
||||
export -f isl_top
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ISL Cat
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_cat()
|
||||
{
|
||||
if [[ "$1" == "-r" ]]
|
||||
then
|
||||
tac ${ISL_FILE}
|
||||
else
|
||||
cat ${ISL_FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
export -f isl_cat
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ISL HTML Dump
|
||||
#-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
isl_html_dump()
|
||||
{
|
||||
r_flag=""
|
||||
i_flag=""
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
if [[ "$1" == "-r" ]]
|
||||
then
|
||||
r_flag="$1"
|
||||
else
|
||||
if [[ "$1" == "-i" ]]
|
||||
then
|
||||
i_flag="-i"
|
||||
fi
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
i=1
|
||||
|
||||
isl_cat "${r_flag}" | while read line
|
||||
do
|
||||
set $line
|
||||
|
||||
if [[ $(( $i % 2)) -eq 0 ]]
|
||||
then
|
||||
print "${i_flag}" ' <tr class="shade">'
|
||||
else
|
||||
print "${i_flag}" " <tr>"
|
||||
fi
|
||||
|
||||
j=1
|
||||
while [[ $j -lt 7 ]]
|
||||
do
|
||||
if [[ "$j" == "1" ]]
|
||||
then
|
||||
print "${i_flag}" " <th>${!j}</th>"
|
||||
else
|
||||
print "${i_flag}" " <td>${!j}</td>"
|
||||
fi
|
||||
|
||||
j=$(( $j + 1))
|
||||
done
|
||||
|
||||
print "${i_flag}" " </tr>"
|
||||
i=$(( $i + 1))
|
||||
done
|
||||
}
|
||||
|
||||
export -f isl_html_dump
|
||||
Reference in New Issue
Block a user