Sync required for reymacs

This commit is contained in:
Jacob Hrbek 2020-08-21 05:48:15 +02:00
parent 28fba9312a
commit 488f2b190f
28 changed files with 1001 additions and 102 deletions

191
scripts/whitepaper.sh Normal file

@ -0,0 +1,191 @@
#!/usr/bin/zernit sh
# Created by Jacob Hrbek <kreyren@rixotstudio,cz> under all rights reserved in 11/08/2020 01:02:33 CEST
# shellcheck shell=sh # Written to be POSIX compatible
###! Script designed to generate the white paper for this project in supported language
###! The whitepaper should be done to be understandable by the general public so avoid over-complication where possible.
[ -n "$whitepaperPath" ] || whitepaperPath="README.md"
# FIXME: Implement logic to deduce this
UPSTREAM_NAME="Zernit"
sectionNumber=0
# Exit on anything unexpected to capture code quality issues
set -x
# Wipe the current whipaper
"$PRINTF" '%s\n' "" > "$whitepaperPath"
# Title
case "$LANG" in
*)
"$CAT" <<-EOF >> "$whitepaperPath"
<h1 align="center">
<a href=$UPSTREAM_REPOSITORY>$PROJECT_NAME</a>
</h1>
EOF
esac
# Preamble
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
$PROJECT_NAME is a system-manager designed to make devices capable of running our written logic painless and efficient while maintaining highest possible code quality standard and platform compatibility.
This whitepaper is not legally bindable and is provided to be used as a reference for the software development and comunity management.
If you find a conflicting part in the source code, then file a new tracking in $UPSTREAM_REPOSITORY and we will process it with relevant priority to ensure that these conditions are met as soon as possible or brainstorm it for this whitepaper to be updated.
Contributions to this whitepaper and suggestions are appreciated to influece the relevant software development.
EOF
esac
# Terminology
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
## $(( sectionNumber + 1 )). Terminology
Software Users (SU) -- Parties that are using this software or are in other way affiliated with it or it's development
EOF
esac
# Ethicality
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
## $(( sectionNumber + 1 )). Project ethiques
FIXME-DOCS
EOF
esac
# Privacy
# FIXME: Add logic for the sub number
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
### $sectionNumber.1 Privacy
This project is designed to provide the absolute anonimity without compromise for it's SU unless relevant juristiction forces it to require informations of relevant parties in the area where said juristiction has the rightful authority to enforce these information processing that would otherwise make the usage of this software illegal in that area.
Data of SU should never be processed without an explicit permission that has to be opted-in and NEVER set by default at the cost of software malfunction (that should be sanitized to avoid fatal failure) where SU should never be prevented from using this software just because they don't want to provide their personal information.
Functions that explicitely require personal information should fail safely if said information is not provided or use a default value allowing the SU to blend into a crowd of anonymous users.
From experience with Enoch-based distributions alike Gentoo Linux as explained on hyperlink https://wiki.gentoo.org/wiki/User:MGorny/GCO_real_name_requirement it's required to provide an indentification to be allowed to submit changes to the source code.
This should never be limited on this project where possible and SU should have the option to submit their contribution under project's name (with their nickname if desired) if they don't want to or can't affort sharing this kind of information assuming that the contribution doesn't break the legal cleanroom and does not have a copyright which would make it impossible to be used in judistical areas that honors copyright law.
EOF
esac
# Freedom
# FIXME: Add logic for the sub number
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
### $sectionNumber.1 Freedom of relevant parties
This project is designed to give it's SU the full freedom of doing whatever they want with the software and most importantly with it's source code as long as it doesn't have a negative impact on the business plan with some flexibility from the Software Authorities.
This solution is not ideal, but it's the best that we currently have, proposals for a better solution are appreciated.
The license should contain 'Four Freedom Compilance' that should be maintained over time to ensure that the license complies with four essential freedoms of Free Software defined by Free Software Foundation as explained in https://en.wikipedia.org/wiki/The_Free_Software_Definition#The_Four_Essential_Freedoms_of_Free_Software
It's important to mension that this project can be abused for an illegal activity as a result of provided freedom above that the project has legal obligation to enforce per local juristiction of the user assuming that the user chosed to provide it's locality where these laws applies. Thus users that chosed to not provide their location should be warned about this risk as they can be legally prosecuted by the relevant juristiction for which zernit is not responsible.
EOF
esac
# Software Design
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
## $(( sectionNumber + 1 )). Software Design
The software is designed to work everywhere possible to be deployed painlessly to manage the target device as efficiently as possible.
EOF
esac
## Cross-platform
case "$LANG" in
en-*|*)
"$CAT" <<-EOF >> "$whitepaperPath"
## $(( sectionNumber + 1 )).1 Cross-platform support
FIXME: Decide
EOF
esac
# FIXME: The backend is currently undetermined
## Downstream
"$CAT" <<-EOF >> "$whitepaperPath"
Zernit is designed to make it efficient for it's SU to implement their own package downstream and make it available for everyone if desired.
Zernit creators are providing their own downstream with work in progress name \`zeres-0\` that is designed to provide system to process source code while giving the SU all available options to efficiently alter the build result
This downstream management is designed to provide tools that may be useful for package processing, but none of them are mandatory meaning that if desired you can run a blank file and zernit won't stop you.
To ensure the expected runtime this is expected to be enforced through provided standard per downstream repository.
## List of downstream items
Zeres-0 devices it's downstream into a \`downstream items\` each of which is designed to process diferent product.
### Packages
Used to process various source code into a package that can be imported on the target system/sandbox.
This downstream item is designed to either process the source code of the software into a package that then can be imported on the system or using pre-built binary with static options made to work on majority of devices.
In terms of database this requires following entries:
- Package Name
- Package Category
- Package Version
- Package Slot
And optionally:
- Homepage
- Upstream repository URL
- Upstream name
- Upstream organization
- License
- And anything relevant which the SU can cherrypick per system
Each package is processed through phases that are designed to each process specific part of the package where the developers have the option to specify which phases will be used to process the package meaning than none of these are mandatory at the cost of software malfunction:
- Fetch
Fetch the source code in the specified destination for processing
- Checksum check
Designed to check the checksum of fetched files that can be (if desired):
1. Checked agains virustotal database
2. Checked agains provided checksum by downstream to ensure that expected file is fetched for processing
- Cache
Designed to cache the source code tarball for processing
SU has options to:
1. Cache the tarball so if the tarball is needed zernit can get this file locally
2. Provide this file as standalone mirror that can be added to the downstream
3. Provide this file through torrent for peer-2-peer distribution
4. Provide this file through custom torrent-inspired distribution system focused on privacy and security
- Configure
Designed to configure the source code for proccessing in the \`compile\` phase
- Compile
Designed to provide backend required to process the package for compilation
- Sandbox
Designed to place the runtime in a jail that prevents the software from accessing the live userland.
- Containerize
Designed to place the content of \`IMAGE\` directory into a redistributable container that runs on the target system without the need for dependencies
To ensure compatibility this has to have a logic to determine wether it's being run on a supported system.
This can be also used for release of pre-compiled targets
- Merge
Merge the content of \`IMAGE\` directory into a live system
### Audio
Designed for distribution of audio tracks
In terms of database this requires following entries:
- Artist name
- Song name
And optionally:
- License
EOF

@ -1,4 +1,6 @@
# RXT0112-1
# The unnamed package manager
FIXME: We need a name (https://github.com/RXT0112/Zernit/issues/156)
Directory for the system manager source code

@ -68,7 +68,7 @@ MAINTAINER_SURNAME="Hrbek"
# Customization of the output
## efixme
[ -z "$EFIXME_FORMAT_STRING" ] && EFIXME_FORMAT_STRING="FIXME: %s\n"
[ -z "$EFIXME_FORMAT_STRING_LOG" ] && EFIXME_FORMAT_STRING="${logPrefix}FIXME: %s\n"
[ -z "$EFIXME_FORMAT_STRING_LOG" ] && EFIXME_FORMAT_STRING_LOG="${logPrefix}FIXME: %s\n"
[ -z "$EFIXME_FORMAT_STRING_DEBUG" ] && EFIXME_FORMAT_STRING_DEBUG="FIXME($myName:$LINENO): %s\n"
[ -z "$EFIXME_FORMAT_STRING_DEBUG_LOG" ] && EFIXME_FORMAT_STRING_DEBUG_LOG="${logPrefix}FIXME($myName:$LINENO): %s\n"
## eerror
@ -93,11 +93,15 @@ MAINTAINER_SURNAME="Hrbek"
[ -z "$DIE_FORMAT_STRING_DEBUG" ] && DIE_FORMAT_STRING_DEBUG="FATAL($myName:$1): %s\n"
[ -z "$DIE_FORMAT_STRING_DEBUG_LOG" ] && DIE_FORMAT_STRING_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s\\n"
### Success trap
# FIXME: Implement logic
[ -z "$DIE_FORMAT_STRING_SUCCESS" ] && DIE_FORMAT_STRING_SUCCESS="FATAL: %s in script '$myName' located at '$0'\\n"
[ -z "$DIE_FORMAT_STRING_LOG" ] && DIE_FORMAT_STRING_LOG="${logPath}FATAL: %s in script '$myName' located at '$0'\\n"
[ -z "$DIE_FORMAT_STRING_DEBUG" ] && DIE_FORMAT_STRING_DEBUG="FATAL($myName:$1): %s\n"
[ -z "$DIE_FORMAT_STRING_DEBUG_LOG" ] && DIE_FORMAT_STRING_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s\\n"
[ -z "$DIE_FORMAT_STRING_SUCCESS" ] && DIE_FORMAT_STRING_SUCCESS="SUCCESS: Script '$myName' located at '$0' finished successfully\\n"
[ -z "$DIE_FORMAT_STRING_LOG" ] && DIE_FORMAT_STRING_LOG="${logPath}$DIE_FORMAT_STRING_SUCCESS"
[ -z "$DIE_FORMAT_STRING_DEBUG" ] && DIE_FORMAT_STRING_DEBUG="SUCCESS($myName:$1): Script '$myName' located at '$0' finished successfully\\n"
[ -z "$DIE_FORMAT_STRING_DEBUG_LOG" ] && DIE_FORMAT_STRING_DEBUG_LOG="${logPrefix}$DIE_FORMAT_STRING_DEBUG_LOG"
### Syntax error (syntaxerr) trap
[ -z "$DIE_FORMAT_STRING_SYNTAXERR" ] && DIE_FORMAT_STRING_SYNTAXERR="SyntaxErr: Invalid argument(s) '$0' '$1' '$2' '$3' '$4' has been provided to $myName\\n"
[ -z "$DIE_FORMAT_STRING_SYNTAXERR_LOG" ] && DIE_FORMAT_STRING_LOG="${logPath}$DIE_FORMAT_STRING_SUCCESS"
[ -z "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG" ] && DIE_FORMAT_STRING_DEBUG="SyntaxErr($myName:$1): Invalid argument(s) '$0' '$1' '$2' '$3' '$4' has been provided to $myName\\n"
[ -z "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG_LOG" ] && DIE_FORMAT_STRING_DEBUG_LOG="${logPrefix}$DIE_FORMAT_STRING_DEBUG_LOG"
### Fixme trap
[ -z "$DIE_FORMAT_STRING_FIXME" ] && DIE_FORMAT_STRING_FIXME="FATAL: %s in script '$myName' located at '$0', fixme?\n"
[ -z "$DIE_FORMAT_STRING_FIXME_LOG" ] && DIE_FORMAT_STRING_FIXME_LOG="${logPrefix}FATAL: %s, fixme?\n"
@ -121,8 +125,8 @@ MAINTAINER_SURNAME="Hrbek"
# elog
[ -z "$ELOG_FORMAT_STRING_DEBUG_LOG" ] && ELOG_FORMAT_STRING_DEBUG_LOG="${logPrefix}LOG: %s\\n"
# ebench
[ -z "$EBENCH_FORMAT_STRING_START" ] && EBENCH_FORMAT_STRING="BENCHMARK: Starting benchmark for action %s\n"
[ -z "$EBENCH_FORMAT_STRING_RESULT" ] && EBENCH_FORMAT_STRING="BENCHMARK: Action %s took $SECONDS seconds\n"
[ -z "$EBENCH_FORMAT_STRING_START" ] && EBENCH_FORMAT_STRING_START="BENCHMARK: Starting benchmark for action %s\n"
[ -z "$EBENCH_FORMAT_STRING_RESULT" ] && EBENCH_FORMAT_STRING_RESULT="BENCHMARK: Action %s took $SECONDS seconds\n"
# invoke_privileged
[ -z "$INVOKE_PRIVILEGED_FORMAT_STRING_QUESTION" ] && INVOKE_PRIVILEGED_FORMAT_STRING_QUESTION="### PRIVILEGED ACCESS REQUEST ###\n\n\s\n"
@ -247,6 +251,9 @@ rootCheck() { funcname=rootCheck
}
# Identify system
# FIXME: /etc/issue could also be used to identify the system
# FIXME: /etc/debian_version can also be used
# FIXME: /etc/devuan_version can also be used
if command -v "$UNAME" 1>/dev/null; then
unameKernel="$("$UNAME" -s)"
edebug "Identified the kernel as '$unameKernel"

@ -0,0 +1,3 @@
# Identifiers
Functions used to identify various elements on the system i.e kernel

@ -0,0 +1,22 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 18/08/2020 08:13:35 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Make sure this works
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
###! Identifier script used to identify a hostname on the target system and store it in 'HOSTNAME' environment variable
# Define hostname
# POSIX: Variable 'HOSTNAME' is not defined on POSIX sh
if command -v hostname 1>/dev/null; then
HOSTNAME="$(hostname)"
elif [ -s /etc/hostname ]; then
HOSTNAME="$("$CAT" /etc/hostname)"
elif ! command -v hostname 1>/dev/null && [ ! -s /etc/hostname ]; then
die false "Unable to determine the hostname from command 'hostname' (which doesn't exists) and from file /etc/hostname (that doesn't exists or is blank)"
else
die unexpected "processing hostname"
fi

@ -0,0 +1,64 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 18/08/2020 08:13:35 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Make sure this works
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
###! Identifier script used to identify:
###! - Kernel - Stored in environment variable 'KERNEL' lowercase i.e 'linux'
###! - Release - Stores
# Identify system
# FIXME: /etc/issue could also be used to identify the system
# FIXME: /etc/debian_version can also be used
# FIXME: /etc/devuan_version can also be used
if "$COMMAND" -v "$UNAME" 1>/dev/null; then
unameKernel="$("$UNAME" -s)"
edebug "Identified the kernel as '$unameKernel"
case "$unameKernel" in
Linux)
KERNEL="$(printf '%s\n' "$unameKernel" | "$TR" [[:upper:]] [[:lower:]])"
# Assume Linux Distro and release
# NOTICE(Krey): We are expecting this to return a lowercase value
if "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null; then
assumedDistro="$("$LSB_RELEASE" -si | "$TR" [[:upper:]] [[:lower:]])"
assumedRelease="$("$LSB_RELEASE" -cs | "$TR" [[:upper:]] [[:lower:]])"
elif ! "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null && [ -f /etc/os-release ]; then
assumedDistro="$("$GREP" -o "^ID\=.*" /etc/os-release | "$SED" s/ID=//gm | "$TR" [[:upper:]] [[:lower:]])"
assumedRelease="$("$GREP" -o "^VERSION_CODENAME\=.*" /etc/os-release | "$SED" s/VERSION_CODENAME=//gm | "$TR" [[:upper:]] [[:lower:]])"
elif ! "$COMMAND" -v "$LSB_RELEASE" 1>/dev/null && [ ! -f /etc/os-release ]; then
die 1 "Unable to identify linux distribution using command 'lsb_release' nor file '/etc/os-release'"
else
die 255 "attempting to assume linux distro and release"
fi
edebug "Identified distribution as '$assumedDistro'"
edebug "Identified distribution release as '$assumedRelease'"
# Verify Linux Distro
efixme "Add sanitization logic for other linux distributions"
case "$assumedDistro" in
ubuntu | debian | fedora | nixos | opensuse | gentoo | exherbo | devuan)
DISTRO="$assumedDistro"
;;
*) die fixme "Unexpected Linux distribution '$assumedDistro' has been detected."
esac
# Verify Linux Distro Release
efixme "Sanitize verification of linux distro release"
RELEASE="$assumedRelease"
;;
FreeBSD | Redox | Darwin | Windows)
KERNEL="$unameKernel"
;;
*) die 255 "Unexpected kernel '$unameKernel'"
esac
elif ! "$COMMAND" -v "$UNAME" 1>/dev/null; then
die 1 "Standard command '$UNAME' is not available on this system, unable to identify kernel"
else
die 255 "Identifying system"
fi

@ -0,0 +1,228 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Make sure this works
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
###! Assertion wrapper that outputs message and exits with specified exit code
# NOTICE-DOCS(Krey): Make sure that the text is easy to follow from the exit code
###! Exit codes:
###! - 0/1 --- General true depending on kernel used
###! - 1/0 --- General false depending on kernel used
###! - 2 ----- syntax error
###! - 3 ----- permission issue
###! - 28 ---- Security trap
###! - 36 ---- Fixme trap
###! - 111 --- Invalid format string (used to capture printf failure)
###! - 126 --- not executable(?)
###! - 223 --- Unexpected trap captured for bug
###! - 255 --- Unexpected trap
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
# NOTICE(Krey): End-users are allowed to customize the format string so we have to capture printf failures using `|| { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}` instead of `die invalid-format`
# FIXME-DUP_CODE: Fix duplicate code for easier maintainance
die() { funcname="die"
case "$2" in
###! Generic true
###! - Used to exit the shell successfully
###! Compatibility: Returns Error code 0 on Unix and Error Code 1 on Windows
"true")
# In case no message is provided
if [ -z "$3" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*)
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "Exitted successfully"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "Exitted successfully" >> "$logPath"
esac
elif [ "$DEBUG" = 1 ]; then
case "$LANG" in
en-*|*)
# FIXME-TRANSLATE: Translate in your language
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "Exitted successfully"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "Exitted successfully" >> "$logPath"
esac
else
# NOTICE(Krey): Do not use die() in die for unexpected
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
# Message on second argument is provided
elif [ -n "$3" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$3"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$3" >> "$logPath"
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$3"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$3" >> "$logPath"
else
# NOTICE(Krey): Do not use die() in die for unexpected
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
fi
# Assertion
case "$KERNEL" in
linux)
unset funcname
exit 0 ;;
windows)
unset funcname
exit 1 ;;
*)
"$PRINTF" 'BUG: %s\n' "Invalid kernel has been provided in $myName for arguments '$*': $KERNEL"
unset funcname
exit 255
esac
;;
###! Generic failure
###! - Used to exit the shell with fatal error
###! Compatibility: Returns Error code 1 on Unix and Error Code 0 on Windows
"false")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FALSE" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
# Assertion
case "$KERNEL" in
linux)
unset funcname
exit 1 ;;
windows)
unset funcname
exit 0 ;;
*)
"$PRINTF" 'BUG: %s\n' "Invalid kernel has been provided in $myName: $KERNEL"
unset funcname
exit 223
esac
;;
2|syntaxerr)
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 28 # In case 'fixme' argument is provided
;;
28|"security")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 28 # In case 'fixme' argument is provided
;;
38|"fixme") # For features that needs to be implemented and prefents runtime from continuing
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FIXME" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 38 # In case 'fixme' argument is provided
;;
111|"invalid-format")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) "$PRINTF" "$DIE_FORMAT_STRING" "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 223 # In case 'bug' is used
;;
223|"bug") # Unexpected trap
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_BUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) "$PRINTF" "$DIE_FORMAT_STRING" "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 223 # In case 'bug' is used
;;
255|"unexpected") # Unexpected trap
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) "$PRINTF" "$DIE_FORMAT_STRING" "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 255 # In case 'unexpected' is used
;;
*)
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) "$PRINTF" 'BUG: %s\n' "Invalid argument '$2' has been provided in $funcname"
esac
unset funcname
exit 255
esac
}; alias die='die "${LINENO:-0}"'

@ -0,0 +1,38 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to time specific actions
# FIXME: Allow timing of specific tasks
# Allow skipping benchmark
ebench() { funcname="ebench"
case "$SKIP_BENCHMARK" in
1)
unset funcname
return 0 ;;
0|"") edebug 3 "Benchmark was not skipped" ;;
*) die 23 "Variable SKIP_BENCHMARK has unexpected value '$SKIP_BENCHMARK', expecting only '1' or blank"
esac
case "$2" in
start)
printf "$EBENCH_FORMAT_STRING_START" "$2" || die invalid-format
# POSIX: We might be able to use /proc/uptime on Unix
efixme "Variable 'SECONDS' is not POSIX compatible, implement logic"
SECONDS=0
unset funcname
return 0 ;;
result)
printf "$EBENCH_FORMAT_STRING_RESULT" "$2" || die invalid-format
unset funcname
return 0 ;;
*) die 2 "Invalid argument '$2' has been parsed in $funcname"
esac
}; alias ebench='ebench "${LINENO:-0}"'

@ -0,0 +1,31 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to output a debug message depending on value in DEBUG variable
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
edebug() { funcname="edebug"
efixme "Implement debug channels in $funcname"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias die='die "${LINENO:-0}"'

@ -0,0 +1,30 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to output an error message about non-fatal issues to inform the end-user
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
eerror() { funcname="eerror"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EERROR_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias eerror='eerror "${LINENO:-0}"'

@ -0,0 +1,53 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to output annoying fixme messages for features that needs to be implemented for the expected runtime, but that doesn't prevent the abstract
###! For example Hotfixes that need proper implementation:
###!
###! # Not up to standard
###! efixme "Sanitize rm"
###! rm something
###!
###! # Better implementation
###! [ -e something ] && rm something
###! Can be disabled by storing value '1' in variable IGNORE_FIXME
# FIXME-QA(Krey): Merge in edebug once debugging channels are implemented?
# - (Krey) Probably better to implement a debug channel that efixme is reading from
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
efixme() { funcname="efixme"
if [ "$IGNORE_FIXME" = 1 ]; then
# FIXME: Implement 'fixme' debug channel
edebug fixme "Fixme message for '$2' disabled"
return 0
elif [ "$IGNORE_FIXME" = 0 ] || [ -z "$IGNORE_FIXME" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EFIXME_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die 255 "processing DEBUG variable with value '$DEBUG' in $funcname"
esac
fi
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die 255 "processing variable IGNORE_FIXME with value '$IGNORE_FIXME' in $0"
esac
fi
}; alias efixme='efixme "${LINENO:-0}"'

@ -0,0 +1,29 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to inform the end-user about what is happening during the runtime
einfo() { funcname="einfo"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EINFO_FORMAT_STRING" "$1" || die invalid-format
"$PRINTF" "$EINFO_FORMAT_STRING_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EINFO_FORMAT_STRING_DEBUG" "$1" || die invalid-format
"$PRINTF" "$EINFO_FORMAT_STRING_DEBUG_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias einfo='einfo "${LINENO:-0}"'

@ -0,0 +1,26 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to store output in log
elog() { funcname="elog"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$ELOG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias einfo='einfo "${LINENO:-0}"'

@ -0,0 +1,29 @@
#!/bin/false
# - Used only for sourcing
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> as All Rights Reserved in 08.07.2020 03:32:02 CET
# Peer-reviewed by <NAME> <EMAIL> in <DATE> <TIME> <TIMEZONE>
# shellcheck shell=sh # Written to be posix-compatible
# DNM: Specify somewhere
# shellcheck source=somewhere
###! Function to warn the end-user about something important
ewarn() { funcname="ewarn"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EWARN_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias ewarn='ewarn "${LINENO:-0}"'

@ -25,13 +25,13 @@
# NOTICE(Krey): End-users are allowed to customize the format string so we have to capture printf failures using `|| { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}` instead of `die invalid-format`
# FIXME-DUP_CODE: Fix duplicate code for easier maintainance
die() { funcname="die"
case "$3" in
case "$1" in
###! Generic true
###! - Used to exit the shell successfully
###! Compatibility: Returns Error code 0 on Unix and Error Code 1 on Windows
"true")
# In case no message is provided
if [ -z "$3" ]; then
if [ -z "$2" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
@ -54,13 +54,13 @@ die() { funcname="die"
esac
fi
# Message on second argument is provided
elif [ -n "$3" ]; then
elif [ -n "$2" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$3"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$3" >> "$logPath"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$2"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$2" >> "$logPath"
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$3"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$3" >> "$logPath"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$2"
"$PRINTF" "$DIE_FORMAT_STRING_TRUE_DEBUG" "$2" >> "$logPath"
else
# NOTICE(Krey): Do not use die() in die for unexpected
case "$LANG" in
@ -89,11 +89,11 @@ die() { funcname="die"
###! Compatibility: Returns Error code 1 on Unix and Error Code 0 on Windows
"false")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FALSE" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FALSE_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
@ -115,13 +115,30 @@ die() { funcname="die"
exit 223
esac
;;
2|syntaxerr)
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SYNTAXERR_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
en-*|*) "$PRINTF" 'BUG: %s\n' "Unexpected happend while processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
unset funcname
exit 28 # In case 'fixme' argument is provided
;;
28|"security")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_SECURITY_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
@ -134,11 +151,11 @@ die() { funcname="die"
;;
38|"fixme") # For features that needs to be implemented and prefents runtime from continuing
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FIXME" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate in your language
@ -151,11 +168,11 @@ die() { funcname="die"
;;
111|"invalid-format")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
@ -168,11 +185,11 @@ die() { funcname="die"
;;
223|"bug") # Unexpected trap
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_BUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_BUG_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
@ -185,11 +202,11 @@ die() { funcname="die"
;;
255|"unexpected") # Unexpected trap
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" "$3" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" "$3" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$2' with message '$3'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" "$2" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
"$PRINTF" "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" "$2" >> "$logPath" || { "$PRINTF" "$DIE_FORMAT_STRING_INVALID_FORMAT" "Invalid format string was parsed in $funcname calling argument '$1' with message '$2'"; exit 111 ;}
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
@ -203,9 +220,9 @@ die() { funcname="die"
*)
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) "$PRINTF" 'BUG: %s\n' "Invalid argument '$3' has been provided in $myName"
en-*|*) "$PRINTF" 'BUG: %s\n' "Invalid argument '$1' has been provided in $funcname"
esac
unset funcname
exit 255
esac
}; alias die='die "${LINENO:-0}"'
}

@ -21,18 +21,18 @@ ebench() { funcname="ebench"
*) die 23 "Variable SKIP_BENCHMARK has unexpected value '$SKIP_BENCHMARK', expecting only '1' or blank"
esac
case "$2" in
case "$1" in
start)
printf "$EBENCH_FORMAT_STRING_START" "$2" || die invalid-format
printf "$EBENCH_FORMAT_STRING_START" "$1" || die invalid-format
# POSIX: We might be able to use /proc/uptime on Unix
efixme "Variable 'SECONDS' is not POSIX compatible, implement logic"
SECONDS=0
unset funcname
return 0 ;;
result)
printf "$EBENCH_FORMAT_STRING_RESULT" "$2" || die invalid-format
printf "$EBENCH_FORMAT_STRING_RESULT" "$1" || die invalid-format
unset funcname
return 0 ;;
*) die 2 "Invalid argument '$2' has been parsed in $funcname"
*) die 2 "Invalid argument '$1' has been parsed in $funcname"
esac
}; alias ebench='ebench "${LINENO:-0}"'
}

@ -9,23 +9,28 @@
###! Function to output a debug message depending on value in DEBUG variable
efixme "Implement debug channels in $funcname"
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
edebug() { funcname="edebug"
efixme "Implement debug channels in $funcname"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias die='die "${LINENO:-0}"'
case "$1" in
*)
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EDEBUG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die 255 "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
;;
esac
}

@ -12,13 +12,13 @@
# NOTICE(Krey): Aliases are required for posix-compatible line output (https://gist.github.com/Kreyren/4fc76d929efbea1bc874760e7f78c810)
eerror() { funcname="eerror"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EERROR_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING" "$1" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG" "$1" || die invalid-format
"$PRINTF" "$EERROR_FORMAT_STRING_DEBUG_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
else
@ -27,4 +27,4 @@ eerror() { funcname="eerror"
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias eerror='eerror "${LINENO:-0}"'
}

@ -25,17 +25,17 @@
efixme() { funcname="efixme"
if [ "$IGNORE_FIXME" = 1 ]; then
# FIXME: Implement 'fixme' debug channel
edebug fixme "Fixme message for '$2' disabled"
edebug fixme "Fixme message for '$1' disabled"
return 0
elif [ "$IGNORE_FIXME" = 0 ] || [ -z "$IGNORE_FIXME" ]; then
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EFIXME_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING" "$1" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG" "$1" || die invalid-format
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
else
@ -50,4 +50,4 @@ efixme() { funcname="efixme"
en-*|*) die 255 "processing variable IGNORE_FIXME with value '$IGNORE_FIXME' in $0"
esac
fi
}; alias efixme='efixme "${LINENO:-0}"'
}

@ -26,4 +26,4 @@ einfo() { funcname="einfo"
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias einfo='einfo "${LINENO:-0}"'
}

@ -10,21 +10,17 @@
###! Function to store output in log
elog() { funcname="elog"
case "$2" in
"debug")
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$ELOG_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi ;;
*) die bug "Invalid argument '$2' has been parsed to $funcname"
esac
}; alias einfo='einfo "${LINENO:-0}"'
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$ELOG_FORMAT_STRING_DEBUG_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
else
case "$LANG" in
# FIXME-TRANSLATE: Translate to more languages
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}

@ -11,13 +11,13 @@
ewarn() { funcname="ewarn"
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
"$PRINTF" "$EWARN_FORMAT_STRING" "$2" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING" "$1" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
elif [ "$DEBUG" = 1 ]; then
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG" "$2" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG" "$1" || die invalid-format
"$PRINTF" "$EWARN_FORMAT_STRING_DEBUG_LOG" "$1" >> "$logPath" || die invalid-format
unset funcname
return 0
else
@ -26,4 +26,4 @@ ewarn() { funcname="ewarn"
en-*|*) die bug "processing variable DEBUG with value '$DEBUG' in $funcname"
esac
fi
}; alias ewarn='ewarn "${LINENO:-0}"'
}

@ -17,6 +17,7 @@
###! else
###! die bug "Function 'cmd_check' returned unexpected exit code"
###! fi
###!
# Check executability of a program
cmd_check() { funcname="cmd_check"

@ -16,18 +16,24 @@ emkdir() { funcname="emkdir"
"linux")
if [ -d "$1" ]; then
edebug "$funcname" "Directory '$1' already exists, no need to create it"
unset funcname
return 0
elif [ ! -d "$1" ]; then
einfo "Creating a new directory in '$1' as requested"
# Create the directory
if cmd_check "$MKDIR"; then
mkdir "$1" || die 1 "Function '$funcname' called from '$myName' is unable to create a new directory in '$1'"
unset funcname
return 0
elif ! cmd_check "$MKDIR"; then
die false "Unable to create a new directory, because neither neither of supported command(s) are available on this system: mkdir"
else
die bug "checking for command used to create directories in $funcname"
fi
else
die bug "checking wether '$1' is a directory"
fi
;;
*) die fixme "Function '$funcname' is not implemented for kernel '$KERNEL'"

@ -15,7 +15,12 @@
invoke_privileged() { funcname="invoke_privileged"
if [ "$privileged" = "false" ]; then
die fixme "Implement $funcname to execute '$2' as privileged user, invoke this script as root as a workaround"
efixme "Implement $funcname to execute '$2' as privileged user, invoking 'sudo' as a workaround"
sudo "$@"
# DNM: HOTFIX!
return 0
edebug "Script '$myName' has been executed from an unprivileged user, deducing possible elevation"

@ -0,0 +1,41 @@
#!/bin/sh
# shellcheck shell=sh # Made to be POSIX compatible
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> under All Rights Reserved in 13/08/2020 22:55:24 CEST
###! Script to generate the readme file for Zernit's project package manager
# FIXME: We need a name (https://github.com/RXT0112/Zernit/issues/156)
projectName="UPM" # Unnamed Package Manager (WIP NAME)
readmePath="src/RXT0112-1/README.md"
whitepaperPath="src/RXT0112-1/WHITEPAPER.md"
# Make sure to not confuse the windows users
case "$KERNEL" in
"windows") fileGroup="folder" ;;
*) fileGroup="directory"
esac
# Generate the readme file
"$CAT" <<-EOF > "$readmePath"
NOTICE: This README file is basically a huge ad designed to waste your time and hype you into liking this project. If you want to know how this software works then see the white paper located at $whitepaperPath.
# $projectName
$projectName is a package manager designed to work on all hardware capable of running our programming logic with the intention of as efficient as theoretically possible management of the target hardware while providing reliable downstream methods to enhance the functionality for mission critical tasks where the end-user has full control over the informations that they are providing for this runtime which includes the ability to see and change the source code.
### User-friendly
If this project is not capable of installing and uninstalling inself on target system without restoring the system into the original state using an intuitive and painless installation process that can be done by the general public then it's considered a bug.
Please file a new issue to $MAINTAINER_REPOSITORY if you encounter any (including minor) problems during these tasks
### Efficiency
This project is designed to have simplified abstract as much as possible to allow it to be rewritten into other programming languages allowing it to be compiled based on the benchmarks conducted on the target system to ensure best possible efficiency with extensive code quality assurance to make it suitable for mission critical tasks.
### Code Quality
WIP
### Privacy
Designed to provide the full control
EOF

@ -0,0 +1,75 @@
#!/bin/sh
# shellcheck shell=sh # Made to be POSIX compatible
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> under All Rights Reserved in 13/08/2020 22:55:24 CEST
###! Script to generate the whitepaper file for Zernit's project package manager
# FIXME: We need a name (https://github.com/RXT0112/Zernit/issues/156)
projectName="UPM" # Unnamed Package Manager (WIP NAME)
readmePath="src/RXT0112-1/README.md"
whitepaperPath="src/RXT0112-1/WHITEPAPER.md"
# Make sure to not confuse the windows users
case "$KERNEL" in
"windows") fileGroup="folder" ;;
*) fileGroup="directory"
esac
# Generate the readme file
"$CAT" <<-EOF > "$readmePath"
PROJECT_NAME
Preamble
# Terminology
# Core concept
**Simplified:** Efficient way to create and manage a database that then is read from a downstream to be implemented in logic or used by the end-user (i.e in GUI)
# Freedom of the affiliated parties
**Simplified(i tried):** You can do whatever you want with the software as long as it doesn't destabilize our business plan or has a negative impact on project economy and doesn't cause permanent or unwanted (permission granted without the use of force or threat) temporary harm to any living life form capable of responding to the pain, having an educated opinion with the ability to argue about their point of view and reasoning using valid arguments based on their method of research unless it's used as a self-defense from conciscously and socially agreed unprovoked attack or to respond to the acts of god to preserve a specie of specified life form without reducing the quality of life of another to the unsustainable point.
# Security
**Simplified:** Overengineered as much as possible enigma machine approach without cryptographically guessable secred due to the wrong syntax that doesn't expect the real life usage which is from real life example using "Hail Hitler" prefix used to decrypt the message. Leaking of unwated informations and allowing unwanted parties from accessing the target system is also not acceptable.
# Privacy
Simplified: The end-user has to allow the software to use that information for that specific time of when it is needed else bug. These information is also expected to be stored securely without allowing unwanted parties from reading them.
The end-users are in full control over the informations that they are providing to the zernit project which are required for the runtime that always has to be **opt-in** and never opt-out to ensure that we are not leaking unwanted informations especially for system with a threat model.
# Transparency
**Simplified:** This project is made to be as transparent as possible thus comunication with the project is expected to be kept public including legal documents.
# Code quality
FIXME-DOCS
# Humanoid culture
Planet Earth has around 7.8 Bilion humanoids (as of 14/08/2020) with diferent cultures that influence the law, ethiques and values of that specific group that is expected to be fully comformed in this project as preserving and respecting the culture is considered as critical in this project.
This is designed to avoid amerikanism <https://en.wikipedia.org/wiki/Americanism_(ideology)> and similar unwanted behavior which has shown to be harmful for the relevant culture violating freedom directive above.
- This issue was also highlighted in Rammstein's song "Amerika" <https://invidious.snopyta.org/watch?v=Rr8ljRgcJNM>.
# Legality
**Simplified:** FIXME-DOCS
Everything in Computer Science can be abused for illegal activity (as defined by the law in relevant areas) which can not be legally endorsed by the project creators since that could result in project being banned in the relevant area or project creators being legally prosecuted for cases where we possibly woudn't have a strong legal defense.
To preserve the freedom directive above project will provide a mandatory restriction flags depending on the location of end-user's IP adress where the end-users are not required to provide the IP adress to use the software since this value can be easily faked making our effort meaningless and unsuitable for privacy concious users that can't effort to share this information.
Thus it was decided that the best approach is to provide a legal warnings to the end-users for situations alike where they have the option to choose their preffered approach at the cost of engaging in illegal activity in their area enforcable by the authorities.
Authorities that proved their claim for the relevant juristiction are also given the absolute right to enforce the restrictions per area that they have provided a valid proof of authority that is ideally expected to be kept public in the repository to comfort the "Transparency" directive.
Authorities are also expected to provide a reasoning for each restriction so that it can be peer-reviewd and tracked by qualified experts to ensure that their claim is valid. Providing these records publicly and reasoning for the restriction is not mandatory and depends on the culture from which the relevant law originated for example totalitarian countries are not expected to be required to provide the reasoning.
# Education
This project is expected to provide a free education allowing the general public to learn how to contribute and use the project and it's relevant parts alongside of basic and advanced concepts of computer science which includes programming languages and maintaining a welcoming community for humanoids who want to learn. This is expected to be provided for free as it's expected to be provided as contributing to the Free and Open-source movement while providing more qualified people to work on projects like ours.
# Continous integration
The ideology of CI in this project is to automate everything. Tasks that require human interfierence are considered as bug.
# Continuous delivery/deployment
We are expecting version and rolling release controlled software to the point of invidual patches without skipping any so that the project can be used for education where the rolling release is expected to be released every X time for users who prefer rolling release.
EOF