Compare commits

..

2 commits

7 changed files with 5867 additions and 157 deletions

40
ivaldi.json Normal file
View file

@ -0,0 +1,40 @@
{
"version": "1",
"name": "mimir",
"kind": "node",
"libs": {
"plankton": [
"base",
"conf",
"file",
"call",
"json",
"string",
"args",
"log"
]
},
"core": [
"helpers/borg.ts",
"conf.ts",
"logic/serialization/_abstract.ts",
"logic/serialization/files.ts",
"logic/serialization/postgresql_dump.ts",
"logic/serialization/_factory.ts",
"logic/transfer/_abstract.ts",
"logic/transfer/local.ts",
"logic/transfer/borg.ts",
"logic/transfer/_factory.ts"
],
"apps": [
{
"name": "main",
"sources": [
"main.ts"
],
"destination": "mimir",
"head": "#!/usr/bin/env node",
"executable": true
}
]
}

View file

@ -12,7 +12,7 @@ erstellt Backup-Skripte anhand einer JSON-Beschreibung
### Anweisungen ### Anweisungen
- `tools/build` (Schalter `-h` nutzer für Hilfe) - `tools/ivaldi build`
## Verwendung ## Verwendung
@ -43,7 +43,7 @@ mimir -c conf.mmr.json run
Hier könnte die Ausgabe bspw. wie folgt aussehen: Hier könnte die Ausgabe bspw. wie folgt aussehen:
``` ```sh
## images ## images
echo '-- images' echo '-- images'

View file

@ -41,7 +41,17 @@ namespace _mimir.serialization.postgresql_dump
) : Array<string> ) : Array<string>
{ {
const result : Array<string> = []; const result : Array<string> = [];
const password_file_path: string = "${HOME}/.pgpass"; const password_file_path : string = "${HOME}/.pgpass";
const password_file_backup_path : string = (password_file_path + ".bak");
result.push(
lib_plankton.string.coin(
"test -f {{path_regular}} && cp {{path_regular}} {{path_backup}}",
{
"path_regular": password_file_path,
"path_backup": password_file_backup_path,
}
)
);
result.push( result.push(
lib_plankton.string.coin( lib_plankton.string.coin(
"echo '{{host}}:{{port}}:{{schema}}:{{username}}:{{password}}' > {{path}} && chmod 0600 {{path}}", "echo '{{host}}:{{port}}:{{schema}}:{{username}}:{{password}}' > {{path}} && chmod 0600 {{path}}",
@ -85,6 +95,15 @@ namespace _mimir.serialization.postgresql_dump
} }
) )
); );
result.push(
lib_plankton.string.coin(
"test -f {{path_backup}} && mv {{path_backup}} {{path_regular}}",
{
"path_regular": password_file_path,
"path_backup": password_file_backup_path,
}
)
);
return result; return result;
} }

View file

@ -1,55 +0,0 @@
#!/usr/bin/env python3
import sys as _sys
import os as _os
import argparse as _argparse
def main():
## args
argument_parser = _argparse.ArgumentParser()
argument_parser.add_argument(
"-c",
"--conf-path",
type = str,
default = None,
metavar = "<conf-path>",
help = "conf path",
)
argument_parser.add_argument(
"-o",
"--output-directory",
type = str,
default = "/tmp/mimir",
metavar = "<output-directory>",
help = "output directory",
)
args = argument_parser.parse_args()
## exec
targets = []
targets.append("main")
if True:
_os.system(
"make dir_build=%s --file=tools/makefile %s"
% (
args.output_directory,
" ".join(targets),
)
)
if True:
if (args.conf_path is None):
pass
else:
_os.system(
"cp %s %s/mmr.json"
% (
args.conf_path,
args.output_directory,
)
)
_sys.stdout.write("%s\n" % args.output_directory)
main()

5805
tools/ivaldi Executable file

File diff suppressed because it is too large Load diff

View file

@ -1,68 +0,0 @@
# Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Backend
# Copyright (C) 2024 Christian Fraß
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
## consts
dir_lib := lib
dir_source := source
dir_temp := /tmp/mimir-temp
dir_build := build
dir_tools := tools
cmd_log := echo "--"
cmd_cat := cat
cmd_chmod := chmod
cmd_mkdir := mkdir -p
cmd_cp := cp
cmd_tsc := tsc
## rules
.PHONY: default
default: main
.PHONY: main
main: ${dir_build}/mimir
${dir_temp}/head.js:
@ ${cmd_log} "head …"
@ ${cmd_mkdir} $(dir $@)
@ echo "#!/usr/bin/env node\n" > $@
${dir_temp}/mimir-raw.js: \
${dir_lib}/plankton/plankton.d.ts \
${dir_source}/helpers/borg.ts \
${dir_source}/conf.ts \
${dir_source}/logic/serialization/_abstract.ts \
${dir_source}/logic/serialization/files.ts \
${dir_source}/logic/serialization/postgresql_dump.ts \
${dir_source}/logic/serialization/_factory.ts \
${dir_source}/logic/transfer/_abstract.ts \
${dir_source}/logic/transfer/local.ts \
${dir_source}/logic/transfer/borg.ts \
${dir_source}/logic/transfer/_factory.ts \
${dir_source}/main.ts
@ ${cmd_log} "compile …"
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_tsc} --lib es2020 --strict $^ --outFile $@
${dir_build}/mimir: \
${dir_temp}/head.js \
${dir_lib}/plankton/plankton.js \
${dir_temp}/mimir-raw.js
@ ${cmd_log} "link …"
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_cat} $^ > $@
@ ${cmd_chmod} +x $@

View file

@ -1,31 +0,0 @@
#!/usr/bin/env sh
## consts
dir=$(pwd)/lib/plankton
modules=""
modules="${modules} base"
modules="${modules} conf"
modules="${modules} file"
modules="${modules} call"
modules="${modules} json"
modules="${modules} string"
modules="${modules} args"
modules="${modules} log"
## exec
mkdir -p ${dir}
mkdir /tmp/sandbox -p
cd /tmp/sandbox
ptk fetch node ${modules}
schwamm --include=/tmp/sandbox/plankton.swm.json --output=dump:logic-decl > ${dir}/plankton.d.ts
schwamm --include=/tmp/sandbox/plankton.swm.json --output=dump:logic-impl > ${dir}/plankton.js
exit
mkdir -p ${dir}
cd ${dir}
ptk bundle node ${modules}
cd - > /dev/null