Compare commits
24 Commits
sms-workfl
...
master
Author | SHA1 | Date | |
---|---|---|---|
ecd7088439 | |||
a4c18ee7bd | |||
ac63aff0cd | |||
08722b8f97 | |||
349c7171fb | |||
a87baf1670 | |||
488f2b190f | |||
28fba9312a | |||
020fe7122c | |||
f13a22b745 | |||
608d8a9ffb | |||
61fffcaec6 | |||
af1f10af15 | |||
850252b9d0 | |||
c441f741a3 | |||
2177394c04 | |||
|
10138de993 | ||
|
b70b06e2fe | ||
|
acc045fe9a | ||
|
e263a78bf1 | ||
|
9672a7ace9 | ||
|
30da3e6b66 | ||
|
d05307e15c | ||
|
828a030375 |
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@ -3,3 +3,7 @@
|
|||||||
FIXME: Preamble needed
|
FIXME: Preamble needed
|
||||||
|
|
||||||
FIXME: Do not assign translate variables in fixme messages
|
FIXME: Do not assign translate variables in fixme messages
|
||||||
|
|
||||||
|
### Translate the project
|
||||||
|
|
||||||
|
Search the code for `FIXME-TRANSLATE` and add logic for your language
|
||||||
|
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
@ -16,4 +16,5 @@ issuehunt: rixotstudio
|
|||||||
otechie: rixotstudio
|
otechie: rixotstudio
|
||||||
|
|
||||||
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
custom: https://my.fsf.org/join
|
# Referer link on github.com/kreyren
|
||||||
|
custom: https://my.fsf.org/join?referrer=3706032
|
||||||
|
86
.github/README.md
vendored
86
.github/README.md
vendored
@ -1,16 +1,86 @@
|
|||||||
**NOTICE:** This project in in "init phase" so everything will be remade into a new orphen branch once methods for quality assurance, documentation, automatization and code is decided to be used as a foundation for new commits
|
**FIXME:** Markdownlint has to be optimized for this file<br>
|
||||||
|
**FIXME:** Source the header in different markdown file to make GitHub README different from GitLab.
|
||||||
|
|
||||||
fixme: Source the header in different markdown file to make GitHub README different from GitLab
|
**FIXME:** Change the name based on name repository used.
|
||||||
|
|
||||||
fixme: Change the name based on repository used.
|
<h1 align="center">
|
||||||
|
<a href=https://github.com/RXT0112/Zernit>Zernit</a> (RXT0112)
|
||||||
|
</h1>
|
||||||
|
<h4 align="center">Community maintained (FIXME: Unknown clarification) designed to work cross-platform and using multiple programming languages depending on which one provides the most efficiency per required runtime on target system</h4>
|
||||||
|
|
||||||
# Zernit (RXT0112)
|
<p align="center">
|
||||||
|
<img src="https://img.shields.io/badge/Maintained%3F-Yes-green?style=for-the-badge">
|
||||||
|
<img src="https://img.shields.io/github/license/RXT0112/Zernit?style=for-the-badge">
|
||||||
|
<img src="https://img.shields.io/github/issues/RXT0112/Zernit?color=violet&style=for-the-badge">
|
||||||
|
<img src="https://img.shields.io/github/stars/RXT0112/Zernit?style=for-the-badge">
|
||||||
|
<img src="https://img.shields.io/github/forks/RXT0112/Zernit?color=teal&style=for-the-badge">
|
||||||
|
</p>
|
||||||
|
|
||||||
System manager of WIP_NAME designed to work cross-platform and using multiple programming languages depending on which one provides the most efficiency per required runtime.
|
**NOTICE:** Code-related implementation merge requests are currently not accepted due to the lack of repository management for multi-language project which is currently being worked on, however merge request will be processed if submitted with a priority affected by this restriction.
|
||||||
|
|
||||||
fixme: Change the URL based on the website used<br>
|
**FIXME:** Change the URL based on the website used<br>
|
||||||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/RXT0112/RXT0112)
|
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/RXT0112/RXT0112)
|
||||||
|
|
||||||
fixme: Add prety button<br>
|
**FIXME:** Add a pretty button<br>
|
||||||
https://codesandbox.io/s/github/RXT0112/RXT0112
|
**FIXME:** codesandbox currently cannot be used for zernit<br>
|
||||||
|
**FIXME:** Add tracking for scodsandbox usage on zernit<br>
|
||||||
|
https://codesandbox.io/sgithub/RXT0112/RXT0112
|
||||||
|
|
||||||
|
**FIXME:** Change the URL based on the website used<br>
|
||||||
|
**FIXME:** repl.it currently cannot be used for zernit<br>
|
||||||
|
**FIXME:** Add tracking for scodsandbox usage on zernit<br>
|
||||||
|
[![Run on Repl.it](https://repl.it/badge/github/RXT0112/Zernit)](https://repl.it/github/RXT0112/Zernit)
|
||||||
|
|
||||||
|
|
||||||
|
## When to make a new issue?
|
||||||
|
|
||||||
|
### Questions
|
||||||
|
All relavant questions are welcomed and will be answered as soon as possible depending on the lenght of the question and the understanding of the supporter.
|
||||||
|
|
||||||
|
### Bugs
|
||||||
|
|
||||||
|
Everything relevant that does not work as expected or can be improved. The more issues we are aware of the more work we can put in to resolve them.
|
||||||
|
|
||||||
|
### Feature requests
|
||||||
|
|
||||||
|
Propose anything we will listen and consider it as long as it's relevant.
|
||||||
|
|
||||||
|
### Legal requests
|
||||||
|
|
||||||
|
**NOTICE:** This is currently being implemented so there might be a delay in responses due to the lack of resources
|
||||||
|
|
||||||
|
This project has custom community maintained license which is designed to avoid common issues related to FSF/GNU/OSS-endorsed licenses while directing the workflow, see License below for more info.
|
||||||
|
|
||||||
|
Anything relevant to legal is welcomed in:
|
||||||
|
- Our bug tracker
|
||||||
|
- Mentioning `@RXT0112/legal-team` in your relevant GitHub tickets
|
||||||
|
- Sending an e-mail on [zernit-legal@rixotstudio.cz](mailto:zernit-legal@rixotstudio.cz)
|
||||||
|
|
||||||
|
## Mentoring program
|
||||||
|
|
||||||
|
**NOTICE:** This is currently work in progress and provided with limited resources
|
||||||
|
|
||||||
|
This project provides a free mentoring program for anyone who makes a new merge request with (TBD)
|
||||||
|
|
||||||
|
This mentoring support is provided by the community for the community to provide a free education to improve the community-wide code quality and to ensure that everyone who wants to code has the resources to start and learn.
|
||||||
|
|
||||||
|
If you need a help on projects outside of project RXT0112 then mension `@RXT0112/mentors` in your GitHub tickets.
|
||||||
|
|
||||||
|
Mentoring support is also provided on community server (TBD)
|
||||||
|
|
||||||
|
Project RXT0112 hopes to provide an environment for everyone to learn, freel free to mension our mentoring program in your repositories.
|
||||||
|
|
||||||
|
|
||||||
|
## Where to get support
|
||||||
|
|
||||||
|
1. For simple questions, guidance and mentoring use chat on https://webchat.freenode.net/#zernit-support
|
||||||
|
2. For complicated issues either:
|
||||||
|
- Mension `@RXT0112/support` in your issues or relevant merge requests on GitHub
|
||||||
|
- Make a new issue in relevant RXT0112 organization (anything relevant is welcomed!)
|
||||||
|
3. Sent an email on [zernit-support@rixotstudio.cz](mailto:zernit-support@rixotstudio.cz)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is designed around a community maintained license that is used to direct a workflow while preserving end-user's freedoms to fix common FSF/GNU/OSS-endorsed license issues (FIXME: Reference the issues) that would allow blockchain implementation and for-profit business plan.
|
||||||
|
|
||||||
|
**NOTICE:** The for-profit business plan is currently being investigated to make it suitable for this project, might be turned in non-profit
|
@ -11,7 +11,7 @@ jobs:
|
|||||||
- uses: actions/stale@v1
|
- uses: actions/stale@v1
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: 'Stale issue message'
|
stale-issue-message: 'FIXME: Stale issue message (https://github.com/RXT0112/Zernit/edit/master/.github/workflows/stale.yml)'
|
||||||
stale-pr-message: 'Stale pull request message'
|
stale-pr-message: 'FIXME: Stale pull request message (https://github.com/RXT0112/Zernit/edit/master/.github/workflows/stale.yml)'
|
||||||
stale-issue-label: 'no-issue-activity'
|
stale-issue-label: 'no-issue-activity'
|
||||||
stale-pr-label: 'no-pr-activity'
|
stale-pr-label: 'no-pr-activity'
|
@ -1,7 +1,8 @@
|
|||||||
|
privileged: true
|
||||||
|
|
||||||
image:
|
image:
|
||||||
file: gitpod/debian.Dockerfile
|
file: gitpod/debian.Dockerfile
|
||||||
|
|
||||||
|
|
||||||
# FIXME: Change gitpod user on GITPOD_GIT_USER_NAME env value
|
# FIXME: Change gitpod user on GITPOD_GIT_USER_NAME env value
|
||||||
tasks:
|
tasks:
|
||||||
# Does not accept Quotation without '|' ?
|
# Does not accept Quotation without '|' ?
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
This project's license is located in the LICENSE directory, please refer there for more informations.
|
All rights reserved by Jacob Hrbek <kreyren@rixotstudio.cz> in 12/07/2018 unless explicitedly specified otherwise.
|
||||||
|
|
||||||
License is transleted through crowdsourcing where file with name EN-LICENSE is the original license.
|
This repository is designed to be used with a licences specified in src/licences that are custom made for this project and projects alike to define a new standard.
|
@ -1,3 +0,0 @@
|
|||||||
This directory contains license used for the whole repository unless defined otherwise in the license itself.
|
|
||||||
|
|
||||||
Everyone has the right to propose new changes for review with reasoning to why they should be adapted.
|
|
5
Makefile
5
Makefile
@ -8,6 +8,11 @@ all:
|
|||||||
@ printf '%s\n' "Unknown option '$1' parsed in target all"
|
@ printf '%s\n' "Unknown option '$1' parsed in target all"
|
||||||
@ exit 2
|
@ exit 2
|
||||||
|
|
||||||
|
## UNLEASH RUNTIME ##
|
||||||
|
|
||||||
|
unleash-elisp:
|
||||||
|
@ src/RXT0112-1/downstream-classes/zeres-0/elisp/UNLEASH.el
|
||||||
|
|
||||||
## BUILD ##
|
## BUILD ##
|
||||||
# All build targets are expected in 'build/build-LANG' where 'LANG' is the unique identifier of the language used
|
# All build targets are expected in 'build/build-LANG' where 'LANG' is the unique identifier of the language used
|
||||||
# FIXME: Replace 'exit 1' with helpful messages
|
# FIXME: Replace 'exit 1' with helpful messages
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Backend for Quality Assurance
|
|
12
emacs.log
Normal file
12
emacs.log
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
SUCCESS: test!
|
||||||
|
SUCCESS: test!
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
||||||
|
SUCCESS: nil
|
@ -1,11 +1,7 @@
|
|||||||
FROM debian:latest
|
FROM debian:latest
|
||||||
|
|
||||||
# FIXME: Outputs `gitpod@ws-ce281d58-997b-44b8-9107-3f2da7feede3:/workspace/gitpod-tests1$` in terminal
|
|
||||||
# FIXME: Add hadolint executable
|
|
||||||
# FIXME: We can use /bin/sh instead of /bin/bash to get minor optimization
|
|
||||||
|
|
||||||
# To avoid bricked workspaces (https://github.com/gitpod-io/gitpod/issues/1171)
|
# To avoid bricked workspaces (https://github.com/gitpod-io/gitpod/issues/1171)
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
@ -22,7 +18,7 @@ RUN useradd \
|
|||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y rustc cargo pkg-config \
|
&& apt-get install -y rustc sudo cargo pkg-config \
|
||||||
&& : "Install hadolint if not available in downstream" \
|
&& : "Install hadolint if not available in downstream" \
|
||||||
&& if ! apt-cache search hadolint | grep -qP "^hadolint -.*"; then { if ! command -v wget >/dev/null; then apt-get install -y wget; fi ;} && wget https://github.com/hadolint/hadolint/releases/download/v1.17.5/hadolint-Linux-x86_64 -O /usr/bin/hadolint && { [ ! -x /usr/bin/hadolint ] && chmod +x /usr/bin/hadolint ;}; elif apt-cache search hadolint | grep -qP "^hadolint -.*"; then apt-get install -y hadolint; fi \
|
&& if ! apt-cache search hadolint | grep -qP "^hadolint -.*"; then { if ! command -v wget >/dev/null; then apt-get install -y wget; fi ;} && wget https://github.com/hadolint/hadolint/releases/download/v1.17.5/hadolint-Linux-x86_64 -O /usr/bin/hadolint && { [ ! -x /usr/bin/hadolint ] && chmod +x /usr/bin/hadolint ;}; elif apt-cache search hadolint | grep -qP "^hadolint -.*"; then apt-get install -y hadolint; fi \
|
||||||
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh \
|
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh \
|
||||||
|
@ -1 +1,15 @@
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
|
# Blocked by https://github.com/gitpod-io/gitpod/issues/39
|
||||||
|
COPY gitpod/scripts/root-access.sh /usr/bin/root-access
|
||||||
|
RUN true "7a8fhs1g" \
|
||||||
|
&& chmod +x /usr/bin/root-access \
|
||||||
|
&& /usr/bin/root-access \
|
||||||
|
&& rm /usr/bin/root-access
|
||||||
|
|
||||||
|
# Blocked by https://github.com/gitpod-io/gitpod/issues/1265
|
||||||
|
COPY gitpod/scripts/vm-support.sh /usr/bin/vm-support
|
||||||
|
RUN true "dg798sda7h" \
|
||||||
|
&& chmod +x /usr/bin/vm-support \
|
||||||
|
&& /usr/bin/vm-support \
|
||||||
|
&& rm /usr/bin/vm-support
|
@ -1,5 +1,19 @@
|
|||||||
FROM gitpod/workspace-full-vnc:latest
|
FROM gitpod/workspace-full-vnc:latest
|
||||||
|
|
||||||
|
# Blocked by https://github.com/gitpod-io/gitpod/issues/39
|
||||||
|
COPY gitpod/scripts/root-access.sh /usr/bin/root-access
|
||||||
|
RUN true "7a8fhs1g" \
|
||||||
|
&& chmod +x /usr/bin/root-access \
|
||||||
|
&& /usr/bin/root-access \
|
||||||
|
&& rm /usr/bin/root-access
|
||||||
|
|
||||||
|
# Blocked by https://github.com/gitpod-io/gitpod/issues/1265
|
||||||
|
COPY gitpod/scripts/vm-support.sh /usr/bin/vm-support
|
||||||
|
RUN true "dg798sda7h" \
|
||||||
|
&& chmod +x /usr/bin/vm-support \
|
||||||
|
&& /usr/bin/vm-support \
|
||||||
|
&& rm /usr/bin/vm-support
|
||||||
|
|
||||||
# FIXME: Add hadolint executable
|
# FIXME: Add hadolint executable
|
||||||
|
|
||||||
# To avoid bricked workspaces (https://github.com/gitpod-io/gitpod/issues/1171)
|
# To avoid bricked workspaces (https://github.com/gitpod-io/gitpod/issues/1171)
|
||||||
|
43
gitpod/scripts/root-access.sh
Normal file
43
gitpod/scripts/root-access.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> under GPLv3 <https://www.gnu.org/licenses/gpl-3.0.en.html> in 19/05/2020 16:28
|
||||||
|
|
||||||
|
###! Terminate gitpod if the blocking root access bug has not been resolved yet
|
||||||
|
|
||||||
|
# FIXME: Quick-script
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# FIXME: Rushed
|
||||||
|
die() {
|
||||||
|
printf 'FATAL: %s\n' "$2"
|
||||||
|
exit "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: Sanitize
|
||||||
|
if ! command -v curl 1>/dev/null; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install curl -y
|
||||||
|
elif command -v curl 1>/dev/null; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
die 255 "processing curl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
bugStatus="$(curl https://api.github.com/repos/gitpod-io/gitpod/issues/39 2>/dev/null | grep -o state.* || true)"
|
||||||
|
|
||||||
|
case "$bugStatus" in
|
||||||
|
"state\": \"open\",")
|
||||||
|
printf '\033[31m\033[1mBLOCKED:\033[0m %s\n' "Gitpod does not provide a root access which is mandatory for this repository, see it's tracking in https://github.com/gitpod-io/gitpod/issues/39"
|
||||||
|
if [ "$GITPOD_IGNORE_BLOCKERS" != 1 ]; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"state\": \"closed\",")
|
||||||
|
true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '\033[31m\033[1mBUG:\033[0m %s\n' "GitHub API returned an unknown state '$bugStatus' of bug https://github.com/gitpod-io/gitpod/issues/39"
|
||||||
|
exit 1
|
||||||
|
esac
|
43
gitpod/scripts/vm-support.sh
Normal file
43
gitpod/scripts/vm-support.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> under GPLv3 <https://www.gnu.org/licenses/gpl-3.0.en.html> in 19/05/2020 16:28
|
||||||
|
|
||||||
|
###! Terminate gitpod if the blocking root access bug has not been resolved yet
|
||||||
|
|
||||||
|
# FIXME: Quick-script
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# FIXME: Rushed
|
||||||
|
die() {
|
||||||
|
printf 'FATAL: %s\n' "$2"
|
||||||
|
exit "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: Sanitize
|
||||||
|
if ! command -v curl 1>/dev/null; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install curl -y
|
||||||
|
elif command -v curl 1>/dev/null; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
die 255 "processing curl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
bugStatus="$(curl https://api.github.com/repos/gitpod-io/gitpod/issues/1265 2>/dev/null | grep -o state.* || true)"
|
||||||
|
|
||||||
|
case "$bugStatus" in
|
||||||
|
"state\": \"open\",")
|
||||||
|
die 1 "Gitpod does not provide a VM support which blocks cross-platform development, see tracking on https://github.com/gitpod-io/gitpod/issues/1265"
|
||||||
|
if [ "$GITPOD_IGNORE_BLOCKERS" != 1 ]; then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"state\": \"closed\",")
|
||||||
|
true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '\033[31m\033[1mBUG:\033[0m %s\n' "GitHub API returned an unknown state '$bugStatus' of bug https://github.com/gitpod-io/gitpod/issues/1265"
|
||||||
|
exit 1
|
||||||
|
esac
|
191
scripts/whitepaper.sh
Normal file
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
|
@ -13,7 +13,7 @@ edition = "2018"
|
|||||||
# FIXME: Replace with latest once development is in gold
|
# FIXME: Replace with latest once development is in gold
|
||||||
clap = "2.33.0"
|
clap = "2.33.0"
|
||||||
# Used for repository management as alternative to 'make'
|
# Used for repository management as alternative to 'make'
|
||||||
cargo-make = "0.28.0"
|
cargo-make = "0.30.0"
|
||||||
# Used for reading toml files
|
# Used for reading toml files
|
||||||
toml = "0.5.6"
|
toml = "0.5.6"
|
||||||
# Custom logging solution
|
# Custom logging solution
|
7
src/RXT0112-1/README.md
Normal file
7
src/RXT0112-1/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# The unnamed package manager
|
||||||
|
|
||||||
|
FIXME: We need a name (https://github.com/RXT0112/Zernit/issues/156)
|
||||||
|
|
||||||
|
Directory for the system manager source code
|
||||||
|
|
||||||
|
FIXME: Name required
|
0
src/RXT0112-1/WHITEPAPER.md
Normal file
0
src/RXT0112-1/WHITEPAPER.md
Normal file
1
src/RXT0112-1/cd/README.md
Normal file
1
src/RXT0112-1/cd/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
FIXME: WIP directory designed for Continuous Delivery of the source code
|
7
src/RXT0112-1/ci/README.md
Normal file
7
src/RXT0112-1/ci/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FIXME: WIP directory designed for quality assurance (also known as Continuous Integration)
|
||||||
|
|
||||||
|
FIXME: The logic should be managed by a custom management system (Should be implemented through https://github.com/RXT0113 so that it can be maintained cross-project)
|
||||||
|
FIXME: Support for TravisCI
|
||||||
|
FIXME: Support for GitHubCI
|
||||||
|
FIXME: Support for CircleCI
|
||||||
|
FIXME: Support for SourceHutCI
|
0
QA/tests/shell/shellizator.bash.disabled → src/RXT0112-1/ci/tests/shell/shellizator.bash.disabled
0
QA/tests/shell/shellizator.bash.disabled → src/RXT0112-1/ci/tests/shell/shellizator.bash.disabled
8
src/RXT0112-1/dist/README.md
vendored
Normal file
8
src/RXT0112-1/dist/README.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Downstream distribution
|
||||||
|
|
||||||
|
To ensure the quality provided on downstream for various distributions this repository prohibits distribution maintainers from making their own 3rd party logic for a package managers thus this directory has been created to monitor the downstream while providing an upstream support.
|
||||||
|
Distribution maintainers that do not satisfy the required standard are not allowed to keep source code for Zernit in their repositories.
|
||||||
|
|
||||||
|
FIXME-LEGAL(Krey): Update Legal
|
||||||
|
FIXME-QA(Krey): Provide a CI that tests the downstream on relevant distributions
|
||||||
|
FIXME-QA(Krey): Provide a CD that distributes the downstream instructions the way that the maintainer prefers (expected to be automated once the change has been made, approved and passed QA)
|
3
src/RXT0112-1/downstream-classes/README.md
Normal file
3
src/RXT0112-1/downstream-classes/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# downstream-classes
|
||||||
|
|
||||||
|
This directory is used to define logic for various downstreaming methods used in zernit
|
3
src/RXT0112-1/downstream-classes/zeres-0/README.md
Normal file
3
src/RXT0112-1/downstream-classes/zeres-0/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# zeres-0
|
||||||
|
|
||||||
|
Initial class designed for the downstream in posix shell
|
5
src/RXT0112-1/downstream-classes/zeres-0/bash/README.md
Normal file
5
src/RXT0112-1/downstream-classes/zeres-0/bash/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Zeres-0 (Bash)
|
||||||
|
|
||||||
|
This directory contains logic for zeres-0 to process standardized bash/shell downstream
|
||||||
|
|
||||||
|
The `UNLEASH` file is the first thing invoked by zernit
|
336
src/RXT0112-1/downstream-classes/zeres-0/bash/UNLEASH.sh
Normal file
336
src/RXT0112-1/downstream-classes/zeres-0/bash/UNLEASH.sh
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# All rights reserved by Jacob Hrbek <kreyren@rixotstudio.cz> in 04/2020 (Prepared for four freedom respecting license)
|
||||||
|
# Peer-reviewed by: <YOUR_NAME> <YOUR_EMAIL> in <DATE+TIME+TIMEZONE>
|
||||||
|
|
||||||
|
# shellcheck shell=sh
|
||||||
|
|
||||||
|
###! Base bashrc for zernit's bash backend
|
||||||
|
###! Requires:
|
||||||
|
# FIXME: Implement logic for this
|
||||||
|
###! - Command 'uname' to identify the kernel
|
||||||
|
# FIXME: Implement logic for this
|
||||||
|
###! - Command 'lsb_release' or file /etc/os-release to identify distribution and release on linux
|
||||||
|
###! Exit codes:
|
||||||
|
###! - FIXME-DOCS(Krey): Defined in die()
|
||||||
|
###! Platforms:
|
||||||
|
###! - [ ] Linux
|
||||||
|
###! - [ ] Debian
|
||||||
|
###! - [ ] Ubuntu
|
||||||
|
###! - [ ] Fedora
|
||||||
|
###! - [ ] NixOS
|
||||||
|
###! - [ ] Archlinux
|
||||||
|
###! - [ ] Alpine
|
||||||
|
###! - [ ] FreeBSD
|
||||||
|
###! - [ ] Darwin
|
||||||
|
###! - MacOS
|
||||||
|
###! - [ ] Redox
|
||||||
|
###! - [ ] ReactOS
|
||||||
|
###! - [ ] Windows
|
||||||
|
###! - [ ] Windows xp
|
||||||
|
###! - [ ] Windows 7
|
||||||
|
###! - [ ] Windows 8
|
||||||
|
###! - [ ] Windows 8.1
|
||||||
|
###! - [ ] Windows 10
|
||||||
|
###! - [ ] Windows/Cygwin
|
||||||
|
###! - [ ] Windows 10
|
||||||
|
###! Code Quality:
|
||||||
|
###! - Replace all external commands alike 'uname' with variable to be replaced in command overrides
|
||||||
|
###! - Everything has to be sanitized
|
||||||
|
###! - Has to be tested in docker and vagrant
|
||||||
|
###! - echo() is non-standard on XNU/Darwin -> Use printf
|
||||||
|
###! - Apply styles to allow translate of the output
|
||||||
|
###! Resources:
|
||||||
|
###! - https://pkgs.org | To search Linux distros for files and package informations
|
||||||
|
|
||||||
|
# Maintainer info
|
||||||
|
UPSTREAM="https://github.com/RXT0112/Zernit"
|
||||||
|
UPSTREAM_NAME="RiXotStudio"
|
||||||
|
UPSTREAM_EMAIL="rxt0112@rixotstudio.cz"
|
||||||
|
MAINTAINER_EMAIL="kreyren@rixotstudio.cz"
|
||||||
|
MAINTAINER_NICKNAME="kreyren"
|
||||||
|
MAINTAINER_NAME="Jacob"
|
||||||
|
MAINTAINER_SURNAME="Hrbek"
|
||||||
|
|
||||||
|
# FIXME-SUGGESTION: _=${var:="some text"} is less verbose and less error prone than [ -z "$var" ] && var="some text"
|
||||||
|
|
||||||
|
# Command overrides
|
||||||
|
## These may be required on some systems
|
||||||
|
[ -z "$PRINTF" ] && PRINTF="printf"
|
||||||
|
[ -z "$WGET" ] && WGET="wget"
|
||||||
|
[ -z "$CURL" ] && CURL="curl"
|
||||||
|
[ -z "$ARIA2C" ] && ARIA2C="aria2c"
|
||||||
|
[ -z "$CHMOD" ] && CHMOD="chmod"
|
||||||
|
[ -z "$UNAME" ] && UNAME="uname"
|
||||||
|
[ -z "$TR" ] && TR="tr"
|
||||||
|
[ -z "$SED" ] && SED="sed"
|
||||||
|
[ -z "$GREP" ] && GREP="grep"
|
||||||
|
|
||||||
|
# Customization of the output
|
||||||
|
## efixme
|
||||||
|
[ -z "$EFIXME_FORMAT_STRING" ] && EFIXME_FORMAT_STRING="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
|
||||||
|
[ -z "$EERROR_FORMAT_STRING" ] && EERROR_FORMAT_STRING="ERROR: %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_LOG" ] && EERROR_FORMAT_STRING_LOG="${logPrefix}ERROR: %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_DEBUG" ] && EERROR_FORMAT_STRING_DEBUG="ERROR($myName:$0): %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_DEBUG_LOG" ] && EERROR_FORMAT_STRING_DEBUG_LOG="${logPrefix}ERROR($myName:$0): %s\n"
|
||||||
|
## edebug
|
||||||
|
[ -z "$EERROR_FORMAT_STRING" ] && EERROR_FORMAT_STRING="ERROR: %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_LOG" ] && EERROR_FORMAT_STRING_LOG="${logPrefix}ERROR: %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_DEBUG" ] && EERROR_FORMAT_STRING_DEBUG="ERROR($myName:$0): %s\n"
|
||||||
|
[ -z "$EERROR_FORMAT_STRING_DEBUG_LOG" ] && EERROR_FORMAT_STRING_DEBUG_LOG="${logPrefix}ERROR($myName:$0): %s\n"
|
||||||
|
## einfo
|
||||||
|
[ -z "$EINFO_FORMAT_STRING" ] && EINFO_FORMAT_STRING="INFO: %s\n"
|
||||||
|
[ -z "$EINFO_FORMAT_STRING_LOG" ] && EINFO_FORMAT_STRING_LOG="${logPrefix}INFO: %s\n"
|
||||||
|
[ -z "$EINFO_FORMAT_STRING_DEBUG" ] && EINFO_FORMAT_STRING_DEBUG="INFO($myName:$0): %s\n"
|
||||||
|
[ -z "$EINFO_FORMAT_STRING_DEBUG_LOG" ] && EINFO_FORMAT_STRING_DEBUG_LOG="${logPrefix}INFO($myName:$0): %s\n"
|
||||||
|
## die
|
||||||
|
### Generic
|
||||||
|
[ -z "$DIE_FORMAT_STRING" ] && DIE_FORMAT_STRING="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"
|
||||||
|
### Success trap
|
||||||
|
[ -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"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG" ] && DIE_FORMAT_STRING_FIXME_DEBUG="FATAL($myName:$1): %s, fixme?\n"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" ] && DIE_FORMAT_STRING_FIXME_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s, fixme?\\n"
|
||||||
|
### Bug Trap
|
||||||
|
[ -z "$DIE_FORMAT_STRING_BUG" ] && DIE_FORMAT_STRING_BUG="BUG: Unexpected happend while processing %s in script '$myName' located at '$0'\\n\\nIf you think that this is a bug, the report it to $UPSTREAM to @$MAINTAINER_NICKNAME with output from $logPath for relevant runtime"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_BUG_LOG" ] && DIE_FORMAT_STRING_BUG_LOG="${logPrefix}$DIE_FORMAT_STRING_BUG"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_BUG_DEBUG" ] && DIE_FORMAT_STRING_BUG_DEBUG="BUG:($myName:$1): ${DIE_FORMAT_STRING_BUG%%BUG:}"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_BUG_DEBUG_LOG" ] && DIE_FORMAT_STRING_BUG_DEBUG_LOG="${logPrefix}$DIE_FORMAT_STRING_BUG_DEBUG"
|
||||||
|
### 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"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG" ] && DIE_FORMAT_STRING_FIXME_DEBUG="FATAL($myName:$1): %s, fixme?\n"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_FIXME_DEBUG_LOG" ] && DIE_FORMAT_STRING_FIXME_DEBUG_LOG="${logPrefix}FATAL($myName:$1): %s, fixme?\\n"
|
||||||
|
### Unexpected trap
|
||||||
|
[ -z "$DIE_FORMAT_STRING_UNEXPECTED" ] && DIE_FORMAT_STRING_UNEXPECTED="FATAL: Unexpected happend while %s in $myName located at $0\\n"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_UNEXPECTED_LOG" ] && DIE_FORMAT_STRING_UNEXPECTED_LOG="${logPrefix}FATAL: Unexpected happend while %s\\n"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG" ] && DIE_FORMAT_STRING_UNEXPECTED_DEBUG="FATAL($myName:$1): Unexpected happend while %s in $myName located at $0\\n"
|
||||||
|
[ -z "$DIE_FORMAT_STRING_UNEXPECTED_DEBUG_LOG" ] && DIE_FORMAT_STRING_UNEXPECTED_DEBUG="${logPrefix}FATAL($myName:$1): Unexpected happend while %s\\n"
|
||||||
|
# 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_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"
|
||||||
|
|
||||||
|
# Exit on anything unexpected
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# NOTICE(Krey): By default busybox outputs a full path in '$0' this is used to strip it
|
||||||
|
myName="${0##*/}"
|
||||||
|
|
||||||
|
# Used to prefix logs with timestemps, uses ISO 8601 by default
|
||||||
|
logPrefix="[ $(date -u +"%Y-%m-%dT%H:%M:%SZ") ] "
|
||||||
|
# Path to which we will save logs
|
||||||
|
# NOTICE(Krey): To avoid storing file '$HOME/.some-name.sh.log' we are stripping the '.sh' here
|
||||||
|
# FIXME-QA: Make sure the the directory path is present or this fails
|
||||||
|
# FIXME-COMPAT: Make sure this works on Windows and Darwin
|
||||||
|
logPath="${XDG_DATA_HOME:-$HOME/.local/share}/${myName%%.sh}.log"
|
||||||
|
|
||||||
|
# inicialize the script in logs
|
||||||
|
# FIXME: Allow end-users to customize this
|
||||||
|
"$PRINTF" '%s\n' "Started $myName on $("$UNAME" -s) at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$logPath"
|
||||||
|
|
||||||
|
# DNM: Specify the path to die()
|
||||||
|
. path/to/die
|
||||||
|
|
||||||
|
# DNM: Specify the path
|
||||||
|
. path/to/einfo
|
||||||
|
|
||||||
|
. path/to/ewarn
|
||||||
|
|
||||||
|
. path/to/efixme
|
||||||
|
|
||||||
|
efixme() { funcname=efixme
|
||||||
|
if [ "$IGNORE_FIXME" = 1 ]; then
|
||||||
|
edebug fixme "Fixme message for '$2' disabled"
|
||||||
|
elif [ "$IGNORE_FIXME" = 0 ] || [ -z "$IGNORE_FIXME" ]; then
|
||||||
|
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
|
||||||
|
"$PRINTF" "$EFIXME_FORMAT_STRING" "$2"
|
||||||
|
"$PRINTF" "$EFIXME_FORMAT_STRING" "$2" >> "$logPath"
|
||||||
|
unset funcname
|
||||||
|
return 0
|
||||||
|
elif [ "$DEBUG" = 1 ]; then
|
||||||
|
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG" "$2"
|
||||||
|
"$PRINTF" "$EFIXME_FORMAT_STRING_DEBUG_LOG" "$2" >> "$logPath"
|
||||||
|
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"'
|
||||||
|
|
||||||
|
# Resolve root
|
||||||
|
rootCheck() { funcname=rootCheck
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) edebug "Resolving root on user with ID '$(id -u)"
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) edebug "Script has been executed as user with ID 0, assuming root"
|
||||||
|
esac
|
||||||
|
# NOTICE(Krey): We are prefixing root commands with '$SUDO', this is done to make sure that we are not using sudo here
|
||||||
|
unset SUDO
|
||||||
|
funcname="$myName"
|
||||||
|
return 0
|
||||||
|
# NOTICE(Krey): The ID 33333 is used by gitpod
|
||||||
|
elif [ "$(id -u)" = 1000 ] || [ "$(id -u)" = 33333 ]; then
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) ewarn "Script $myName is not expected to run as non-root, trying to elevate root.."
|
||||||
|
esac
|
||||||
|
|
||||||
|
if command -v sudo 1>/dev/null; then
|
||||||
|
case "$LANG" in
|
||||||
|
en-*|*) einfo "Found 'sudo' that can be used for root elevation"
|
||||||
|
esac
|
||||||
|
|
||||||
|
SUDO=sudo
|
||||||
|
funcname="$myName"
|
||||||
|
return 0
|
||||||
|
elif command -v su 1>/dev/null; then
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) einfo "Found 'su' that can be used for a root elevation"
|
||||||
|
esac
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) ewarn "This will require the end-user to parse a root password multiple times assuming that root has a password set"
|
||||||
|
esac
|
||||||
|
SUDO=su
|
||||||
|
funcname="$myName"
|
||||||
|
return 0
|
||||||
|
elif ! command -v sudo 1>/dev/null && ! command -v su 1>/dev/null; then
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) die 3 "Script $myName depends on root permission to install packages where commands 'sudo' nor 'su' are available for root elevation"
|
||||||
|
esac
|
||||||
|
funcname="$myName"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) die 225 "processing root on non-root"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
case "$LANG" in
|
||||||
|
# FIXME-TRANSLATE: Translate to more languages
|
||||||
|
en-*|*) die 3 "Unknown user ID '$(id -u)' has been parsed in script $myName"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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="$unameKernel"
|
||||||
|
|
||||||
|
# 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)"
|
||||||
|
assumedRelease="$("$GREP" -o"^VERSION_CODENAME\=.*" /etc/os-release | "$SED" s/VERSION_CODENAME=//gm)"
|
||||||
|
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)
|
||||||
|
DISTRO="$assumedDistro"
|
||||||
|
;;
|
||||||
|
*) die fixme "Unexpected Linux distribution '$assumedDistro' has been detected."
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Verify Linux Distro Release
|
||||||
|
efixme "Sanitize verification of linux distro release"
|
||||||
|
assumedRelease="$RELEASE"
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
|
||||||
|
# Define hostname
|
||||||
|
# NOTICE: 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
|
||||||
|
|
||||||
|
# Argument management
|
||||||
|
while [ "$#" -gt 0 ]; do case "$1" in
|
||||||
|
install-deps)
|
||||||
|
packageManagement
|
||||||
|
;;
|
||||||
|
test-docker-debian)
|
||||||
|
efixme "Implement logic to make sure that docker is available"
|
||||||
|
die fixme "Implement tests for debian on docker"
|
||||||
|
$SUDO docker run debian sh -c "true \
|
||||||
|
&& apt-get update -q \
|
||||||
|
&& apt-get install -qy lsb-release \
|
||||||
|
&& sh $0"
|
||||||
|
;;
|
||||||
|
--help|help)
|
||||||
|
efixme "HELP_MESSAGE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die 2 "FIXME_MESSAGE"
|
||||||
|
;;
|
||||||
|
esac; done
|
@ -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}"'
|
228
src/RXT0112-1/downstream-classes/zeres-0/bash/output/die.sh
Normal file
228
src/RXT0112-1/downstream-classes/zeres-0/bash/output/die.sh
Normal file
@ -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 "$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 "$2" ]; 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 "$2" ]; then
|
||||||
|
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
|
||||||
|
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$2"
|
||||||
|
"$PRINTF" "$DIE_FORMAT_STRING_TRUE" "$2" >> "$logPath"
|
||||||
|
elif [ "$DEBUG" = 1 ]; then
|
||||||
|
"$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
|
||||||
|
# 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" "$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" "$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
|
||||||
|
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" "$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" "$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" "$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
|
||||||
|
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" "$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" "$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
|
||||||
|
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" "$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" "$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
|
||||||
|
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" "$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" "$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
|
||||||
|
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" "$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" "$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
|
||||||
|
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 '$1' has been provided in $funcname"
|
||||||
|
esac
|
||||||
|
unset funcname
|
||||||
|
exit 255
|
||||||
|
esac
|
||||||
|
}
|
@ -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 "$1" in
|
||||||
|
start)
|
||||||
|
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" "$1" || die invalid-format
|
||||||
|
unset funcname
|
||||||
|
return 0 ;;
|
||||||
|
*) die 2 "Invalid argument '$1' has been parsed in $funcname"
|
||||||
|
esac
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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"
|
||||||
|
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
|
||||||
|
}
|
@ -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" "$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" "$1" || die invalid-format
|
||||||
|
"$PRINTF" "$EERROR_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
|
||||||
|
}
|
@ -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 '$1' disabled"
|
||||||
|
return 0
|
||||||
|
elif [ "$IGNORE_FIXME" = 0 ] || [ -z "$IGNORE_FIXME" ]; then
|
||||||
|
if [ "$DEBUG" = 0 ] || [ -z "$DEBUG" ]; then
|
||||||
|
"$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" "$1" || die invalid-format
|
||||||
|
"$PRINTF" "$EFIXME_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 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
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
26
src/RXT0112-1/downstream-classes/zeres-0/bash/output/elog.sh
Normal file
26
src/RXT0112-1/downstream-classes/zeres-0/bash/output/elog.sh
Normal file
@ -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" "$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
|
||||||
|
}
|
@ -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" "$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" "$1" || die invalid-format
|
||||||
|
"$PRINTF" "$EWARN_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
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to fetch source code to be processed
|
||||||
|
|
||||||
|
src_fetch() { funcname="src_fetch"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to configure the source code for compilation
|
||||||
|
|
||||||
|
src_configure() { funcname="src_configure"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to compile the source code
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to compile the source code
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to compile the source code
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to perform benchmarks on source code
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to install the compiled source code in sandboxed environment for testing
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase process content of sandboxed directory into a container package i.e appimage
|
||||||
|
###! - This is expected to be processed on demand
|
||||||
|
|
||||||
|
src_compile() { funcname="src_compile"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#!/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
|
||||||
|
# shellcheck source=src/RXT0112-1/downstream-classes/zeres-0/bash/zernit.bashrc
|
||||||
|
|
||||||
|
###! Phase to merge processed source code from sandboxed directory in live system
|
||||||
|
|
||||||
|
# FIXME: Duplicates are a concern
|
||||||
|
|
||||||
|
src_merge() { funcname="src_merge"
|
||||||
|
die fixme "Implement $funcname"
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
# Processing phases
|
||||||
|
|
||||||
|
This directory is used to define processing phases on zernit's runtime
|
@ -0,0 +1,3 @@
|
|||||||
|
# Utilities
|
||||||
|
|
||||||
|
Directory for various utilities used in downstream
|
@ -0,0 +1,12 @@
|
|||||||
|
#!/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 check if relevant option is set
|
||||||
|
|
||||||
|
die fixme "Implement 'option' command"
|
@ -0,0 +1,13 @@
|
|||||||
|
#!/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 source shell library to expected environment
|
||||||
|
###! NOTE: On bash this would be `source path/to/file` which is not posix-compatible and we need it to source only expected files from expected paths
|
||||||
|
|
||||||
|
die fixme "Implement 'require' command"
|
@ -0,0 +1,5 @@
|
|||||||
|
# Wrappers
|
||||||
|
|
||||||
|
Directory dedicated to various wrapper functions
|
||||||
|
|
||||||
|
Wrapper meaning that they wrap another function to handle it's functionality
|
@ -0,0 +1,58 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
###! Sanitized wrapper to check if command is executable in it's environment
|
||||||
|
###! Example usage:
|
||||||
|
###!
|
||||||
|
###! if cmd_check bash; then
|
||||||
|
###! printf '%s\n' "Command 'bash' is executable! ^o^"
|
||||||
|
###! elif ! cmd_check bash; then
|
||||||
|
###! printf '%s\n' "Command 'bash' is not executable! :("
|
||||||
|
###! else
|
||||||
|
###! die bug "Function 'cmd_check' returned unexpected exit code"
|
||||||
|
###! fi
|
||||||
|
###!
|
||||||
|
|
||||||
|
# Check executability of a program
|
||||||
|
cmd_check() { funcname="cmd_check"
|
||||||
|
# FIXME-STUB: This is a stub implementation
|
||||||
|
if command; then
|
||||||
|
true
|
||||||
|
elif ! command; then
|
||||||
|
die fixme "Command 'command' is not executable on this system when runtime requested function '$funcname', we are unable to continue"
|
||||||
|
else
|
||||||
|
die unexpected "Unexpected happend while checking command 'command' in $funcname"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v "$1" 1>/dev/null; then
|
||||||
|
edebug cmd_check "Command '$1' has been confirmed to be executable on this system"
|
||||||
|
case "$KERNEL" in
|
||||||
|
"linux")
|
||||||
|
unset funcname
|
||||||
|
return 0 ;;
|
||||||
|
"windows")
|
||||||
|
unset funcname
|
||||||
|
return 1 ;;
|
||||||
|
*) die fixme "Kernel '$KERNEL' is not implemented in function '$funcname'"
|
||||||
|
esac
|
||||||
|
elif ! command -v "$1" 1>/dev/null; then
|
||||||
|
edebug cmd_check "Command '$1' is not executable on this system"
|
||||||
|
case "$KERNEL" in
|
||||||
|
"linux")
|
||||||
|
unset funcname
|
||||||
|
return 1 ;;
|
||||||
|
"windows")
|
||||||
|
unset funcname
|
||||||
|
return 0 ;;
|
||||||
|
*) die fixme "Kernel '$KERNEL' is not implemented in function '$funcname'"
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
die unexpected "Command 'command' returned an unexpected result in function '$funcname'"
|
||||||
|
fi
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
###! Sanitized wrapper to create a directory
|
||||||
|
|
||||||
|
emkdir() { funcname="emkdir"
|
||||||
|
edebug "$funcname" "Instructed to create directory at path '$1'"
|
||||||
|
|
||||||
|
case "$KERNEL" in
|
||||||
|
"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'"
|
||||||
|
esac
|
||||||
|
|
||||||
|
die security "Function '$funcname' escaped sanitization"
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user