diff --git a/flake.nix b/flake.nix
index 26799c7..4e11fbe 100644
--- a/flake.nix
+++ b/flake.nix
@@ -49,8 +49,8 @@
pkgs,
}: {
packages.${system} = import ./package { inherit system pkgs self; };
- legacyPackages.${system} = import nixpkgs { inherit system overlays; };
- devShells.${system} = import ./devshell { inherit self system pkgs; };
+ legacyPackages.${system} = import ./legacy { inherit system pkgs self; };
+ devShells.${system} = import ./devshell { inherit system pkgs self; };
nixosConfigurations = {
"devvm-manual|${system}" = import ./nixos/system/devvm-manual/default.nix
{ inherit flake self inputs system; };
diff --git a/legacy/default.nix b/legacy/default.nix
new file mode 100644
index 0000000..6a3dda3
--- /dev/null
+++ b/legacy/default.nix
@@ -0,0 +1,4 @@
+{ self, system, pkgs }:
+{
+ writers = pkgs.callPackage ./writer { };
+}
diff --git a/legacy/writer/default.nix b/legacy/writer/default.nix
new file mode 100644
index 0000000..4a9c488
--- /dev/null
+++ b/legacy/writer/default.nix
@@ -0,0 +1,51 @@
+{
+ lib,
+ writers,
+ gcc,
+}: let
+ writeC = name: argsOrScript:
+ if lib.isAttrs argsOrScript && !lib.isDerivation argsOrScript
+ then
+ writers.makeBinWriter (
+ argsOrScript
+ // {
+ compileScript = ''
+ # Force gcc to treat the input file as C code
+ ${gcc}/bin/gcc -fsyntax-only -xc $contentPath
+ if [ $? -ne 0 ]; then
+ echo "Syntax check failed"
+ exit 1
+ fi
+ ${gcc}/bin/gcc -xc -o $out $contentPath
+ '';
+ }
+ )
+ name
+ else
+ writers.makeBinWriter {
+ compileScript = ''
+ # Force gcc to treat the input file as C code
+ ${gcc}/bin/gcc -fsyntax-only -xc $contentPath
+ if [ $? -ne 0 ]; then
+ echo "Syntax check failed"
+ exit 1
+ fi
+ ${gcc}/bin/gcc -xc -o $out $contentPath
+ '';
+ }
+ name
+ argsOrScript;
+ writeMinC = name: includes: body:
+ writeC name ''
+ ${builtins.concatStringsSep "\n" (map (h: "#include " + h) includes)}
+
+ int main(int argc, char *argv[]) {
+ ${body}
+ }
+ '';
+in {
+ writeCBin = name: writeC "/bin/${name}";
+ writeC = writeC;
+ writeMinCBin = name: includes: body: writeMinC "/bin/${name}" includes body;
+ writeMinC = writeMinC;
+}
diff --git a/legacy/writer/writeDashApplication.nix b/legacy/writer/writeDashApplication.nix
new file mode 100644
index 0000000..1d7dbd4
--- /dev/null
+++ b/legacy/writer/writeDashApplication.nix
@@ -0,0 +1,150 @@
+{
+ /*
+ The name of the script to write.
+
+ Type: String
+ */
+ name,
+ /*
+ The shell script's text, not including a shebang.
+
+ Type: String
+ */
+ text,
+ /*
+ Inputs to add to the shell script's `$PATH` at runtime.
+
+ Type: [String|Derivation]
+ */
+ runtimeInputs ? [ ],
+ /*
+ Extra environment variables to set at runtime.
+
+ Type: AttrSet
+ */
+ runtimeEnv ? null,
+ /*
+ `stdenv.mkDerivation`'s `meta` argument.
+
+ Type: AttrSet
+ */
+ meta ? { },
+ /*
+ `stdenv.mkDerivation`'s `passthru` argument.
+
+ Type: AttrSet
+ */
+ passthru ? { },
+ /*
+ The `checkPhase` to run. Defaults to `shellcheck` on supported
+ platforms and `bash -n`.
+
+ The script path will be given as `$target` in the `checkPhase`.
+
+ Type: String
+ */
+ checkPhase ? null,
+ /*
+ Checks to exclude when running `shellcheck`, e.g. `[ "SC2016" ]`.
+
+ See for a list of checks.
+
+ Type: [String]
+ */
+ excludeShellChecks ? [ ],
+ /*
+ Extra command-line flags to pass to ShellCheck.
+
+ Type: [String]
+ */
+ extraShellCheckFlags ? [ ],
+ /*
+ Bash options to activate with `set -o` at the start of the script.
+
+ Defaults to `[ "errexit" "nounset" "pipefail" ]`.
+
+ Type: [String]
+ */
+ bashOptions ? [
+ "errexit"
+ "nounset"
+ "pipefail"
+ ],
+ /*
+ Extra arguments to pass to `stdenv.mkDerivation`.
+
+ :::{.caution}
+ Certain derivation attributes are used internally,
+ overriding those could cause problems.
+ :::
+
+ Type: AttrSet
+ */
+ derivationArgs ? { },
+ /*
+ Whether to inherit the current `$PATH` in the script.
+
+ Type: Bool
+ */
+ inheritPath ? true,
+}:
+writeTextFile {
+ inherit
+ name
+ meta
+ passthru
+ derivationArgs
+ ;
+ executable = true;
+ destination = "/bin/${name}";
+ allowSubstitutes = true;
+ preferLocalBuild = false;
+ text =
+ ''
+ #!${dash}/bin/dash
+ ${lib.concatMapStringsSep "\n" (option: "set -o ${option}") bashOptions}
+ ''
+ + lib.optionalString (runtimeEnv != null) (
+ lib.concatStrings (
+ lib.mapAttrsToList (name: value: ''
+ ${lib.toShellVar name value}
+ export ${name}
+ '') runtimeEnv
+ )
+ )
+ + lib.optionalString (runtimeInputs != [ ]) ''
+
+ export PATH="${lib.makeBinPath runtimeInputs}${lib.optionalString inheritPath ":$PATH"}"
+ ''
+ + ''
+
+ ${text}
+ '';
+
+ checkPhase =
+ let
+ excludeFlags = lib.optionals (excludeShellChecks != [ ]) [
+ "--exclude"
+ (lib.concatStringsSep "," excludeShellChecks)
+ ];
+ # GHC (=> shellcheck) isn't supported on some platforms (such as risc-v)
+ # but we still want to use writeShellApplication on those platforms
+ shellcheckCommand = lib.optionalString shellcheck-minimal.compiler.bootstrapAvailable ''
+ # use shellcheck which does not include docs
+ # pandoc takes long to build and documentation isn't needed for just running the cli
+ ${lib.getExe shellcheck-minimal} ${
+ lib.escapeShellArgs (excludeFlags ++ extraShellCheckFlags)
+ } "$target"
+ '';
+ in
+ if checkPhase == null then
+ ''
+ runHook preCheck
+ #dryrun
+ ${dash}/bin/dash -n -O extglob "$target"
+ ${shellcheckCommand}
+ runHook postCheck
+ ''
+ else
+ checkPhase;
+};
diff --git a/nixos/module/hectic/service/sentinèlla.nix b/nixos/module/hectic/service/sentinèlla.nix
index 8107023..813c677 100644
--- a/nixos/module/hectic/service/sentinèlla.nix
+++ b/nixos/module/hectic/service/sentinèlla.nix
@@ -24,6 +24,15 @@ in {
urls to check
'';
};
+ authFile = lib.mkOption {
+ type = lib.types.path;
+ example = ''
+ config.sops.secrets."name-of-service/sentinèlla-probe".path
+ '';
+ description = ''
+ file with lines: user:pass
+ '';
+ };
volumes = lib.mkOption {
type = lib.types.port;
description = ''
@@ -44,9 +53,10 @@ in {
description = ''
in case when you do not want show configurations in repository
```
- VOLUMES=
- URLS=
+ VOLUMES= # default: none
+ URLS= # default: all from df -P
PORT=
+ AUTH_FILE= # lines: user:pass
```
'';
};
diff --git a/nixos/system/devvm-hemar/default.nix b/nixos/system/devvm-hemar/default.nix
index f2215b7..b38830b 100644
--- a/nixos/system/devvm-hemar/default.nix
+++ b/nixos/system/devvm-hemar/default.nix
@@ -9,7 +9,10 @@
name = builtins.baseNameOf ./.;
in self.lib.nixpkgs-lib.nixosSystem {
- inherit (self.legacyPackages."${system}") pkgs;
+ pkgs = import inputs.nixpkgs-25-05 {
+ inherit system;
+ overlays = [ self.overlays.default ];
+ };
modules = [
{ networking.hostName = name; }
(import ./${name}.nix { inherit flake self inputs; })
diff --git a/nixos/system/devvm-manual/default.nix b/nixos/system/devvm-manual/default.nix
index f2215b7..b38830b 100644
--- a/nixos/system/devvm-manual/default.nix
+++ b/nixos/system/devvm-manual/default.nix
@@ -9,7 +9,10 @@
name = builtins.baseNameOf ./.;
in self.lib.nixpkgs-lib.nixosSystem {
- inherit (self.legacyPackages."${system}") pkgs;
+ pkgs = import inputs.nixpkgs-25-05 {
+ inherit system;
+ overlays = [ self.overlays.default ];
+ };
modules = [
{ networking.hostName = name; }
(import ./${name}.nix { inherit flake self inputs; })
diff --git a/nixos/system/yukkop/default.nix b/nixos/system/yukkop/default.nix
index f2215b7..b38830b 100644
--- a/nixos/system/yukkop/default.nix
+++ b/nixos/system/yukkop/default.nix
@@ -9,7 +9,10 @@
name = builtins.baseNameOf ./.;
in self.lib.nixpkgs-lib.nixosSystem {
- inherit (self.legacyPackages."${system}") pkgs;
+ pkgs = import inputs.nixpkgs-25-05 {
+ inherit system;
+ overlays = [ self.overlays.default ];
+ };
modules = [
{ networking.hostName = name; }
(import ./${name}.nix { inherit flake self inputs; })
diff --git a/overlay/default.nix b/overlay/default.nix
index 0fa4f7d..0343fc9 100644
--- a/overlay/default.nix
+++ b/overlay/default.nix
@@ -2,78 +2,31 @@
lib = nixpkgs.lib;
in final: prev: (
let
- hectic-packages = self.packages.${prev.system};
+ packages = self.packages.${prev.system};
+ legacyPackages = self.legacyPackages.${prev.system};
in {
- hectic = hectic-packages;
+ hectic = packages;
postgresql_17 = prev.postgresql_17 // {pkgs = prev.postgresql_17.pkgs // {
- http = hectic-packages.pg-17-ext-http;
- pg_smtp_client = hectic-packages.pg-17-ext-smtp-client;
- plhaskell = hectic-packages.pg-17-ext-plhaskell;
- plsh = hectic-packages.pg-17-ext-plsh;
- hemar = hectic-packages.pg-17-ext-hemar;
+ http = packages.pg-17-ext-http;
+ pg_smtp_client = packages.pg-17-ext-smtp-client;
+ plhaskell = packages.pg-17-ext-plhaskell;
+ plsh = packages.pg-17-ext-plsh;
+ hemar = packages.pg-17-ext-hemar;
};};
postgresql_16 = prev.postgresql_16 // {pkgs = prev.postgresql_16.pkgs // {
- http = hectic-packages.pg-16-ext-http;
- pg_smtp_client = hectic-packages.pg-16-ext-smtp-client;
- plhaskell = hectic-packages.pg-16-ext-plhaskell;
- plsh = hectic-packages.pg-16-ext-plsh;
- hemar = hectic-packages.pg-16-ext-hemar;
+ http = packages.pg-16-ext-http;
+ pg_smtp_client = packages.pg-16-ext-smtp-client;
+ plhaskell = packages.pg-16-ext-plhaskell;
+ plsh = packages.pg-16-ext-plsh;
+ hemar = packages.pg-16-ext-hemar;
};};
postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // {
- http = hectic-packages.pg-15-ext-http;
- pg_smtp_client = hectic-packages.pg-15-ext-smtp-client;
- plhaskell = hectic-packages.pg-15-ext-plhaskell;
- plsh = hectic-packages.pg-15-ext-plsh;
- hemar = hectic-packages.pg-15-ext-hemar;
+ http = packages.pg-15-ext-http;
+ pg_smtp_client = packages.pg-15-ext-smtp-client;
+ plhaskell = packages.pg-15-ext-plhaskell;
+ plsh = packages.pg-15-ext-plsh;
+ hemar = packages.pg-15-ext-hemar;
};};
- writers = let
- writeC = name: argsOrScript:
- if lib.isAttrs argsOrScript && !lib.isDerivation argsOrScript
- then
- prev.writers.makeBinWriter (
- argsOrScript
- // {
- compileScript = ''
- # Force gcc to treat the input file as C code
- ${prev.gcc}/bin/gcc -fsyntax-only -xc $contentPath
- if [ $? -ne 0 ]; then
- echo "Syntax check failed"
- exit 1
- fi
- ${prev.gcc}/bin/gcc -xc -o $out $contentPath
- '';
- }
- )
- name
- else
- prev.writers.makeBinWriter {
- compileScript = ''
- # Force gcc to treat the input file as C code
- ${prev.gcc}/bin/gcc -fsyntax-only -xc $contentPath
- if [ $? -ne 0 ]; then
- echo "Syntax check failed"
- exit 1
- fi
- ${prev.gcc}/bin/gcc -xc -o $out $contentPath
- '';
- }
- name
- argsOrScript;
- writeMinC = name: includes: body:
- writeC name ''
- ${builtins.concatStringsSep "\n" (map (h: "#include " + h) includes)}
-
- int main(int argc, char *argv[]) {
- ${body}
- }
- '';
- in
- prev.writers
- // {
- writeCBin = name: writeC "/bin/${name}";
- writeC = writeC;
- writeMinCBin = name: includes: body: writeMinC "/bin/${name}" includes body;
- writeMinC = writeMinC;
- };
+ writers = prev.writers // legacyPackages.writers;
}
)
diff --git a/overlay/writeDashApplication.nix b/overlay/writeDashApplication.nix
new file mode 100644
index 0000000..1d7dbd4
--- /dev/null
+++ b/overlay/writeDashApplication.nix
@@ -0,0 +1,150 @@
+{
+ /*
+ The name of the script to write.
+
+ Type: String
+ */
+ name,
+ /*
+ The shell script's text, not including a shebang.
+
+ Type: String
+ */
+ text,
+ /*
+ Inputs to add to the shell script's `$PATH` at runtime.
+
+ Type: [String|Derivation]
+ */
+ runtimeInputs ? [ ],
+ /*
+ Extra environment variables to set at runtime.
+
+ Type: AttrSet
+ */
+ runtimeEnv ? null,
+ /*
+ `stdenv.mkDerivation`'s `meta` argument.
+
+ Type: AttrSet
+ */
+ meta ? { },
+ /*
+ `stdenv.mkDerivation`'s `passthru` argument.
+
+ Type: AttrSet
+ */
+ passthru ? { },
+ /*
+ The `checkPhase` to run. Defaults to `shellcheck` on supported
+ platforms and `bash -n`.
+
+ The script path will be given as `$target` in the `checkPhase`.
+
+ Type: String
+ */
+ checkPhase ? null,
+ /*
+ Checks to exclude when running `shellcheck`, e.g. `[ "SC2016" ]`.
+
+ See for a list of checks.
+
+ Type: [String]
+ */
+ excludeShellChecks ? [ ],
+ /*
+ Extra command-line flags to pass to ShellCheck.
+
+ Type: [String]
+ */
+ extraShellCheckFlags ? [ ],
+ /*
+ Bash options to activate with `set -o` at the start of the script.
+
+ Defaults to `[ "errexit" "nounset" "pipefail" ]`.
+
+ Type: [String]
+ */
+ bashOptions ? [
+ "errexit"
+ "nounset"
+ "pipefail"
+ ],
+ /*
+ Extra arguments to pass to `stdenv.mkDerivation`.
+
+ :::{.caution}
+ Certain derivation attributes are used internally,
+ overriding those could cause problems.
+ :::
+
+ Type: AttrSet
+ */
+ derivationArgs ? { },
+ /*
+ Whether to inherit the current `$PATH` in the script.
+
+ Type: Bool
+ */
+ inheritPath ? true,
+}:
+writeTextFile {
+ inherit
+ name
+ meta
+ passthru
+ derivationArgs
+ ;
+ executable = true;
+ destination = "/bin/${name}";
+ allowSubstitutes = true;
+ preferLocalBuild = false;
+ text =
+ ''
+ #!${dash}/bin/dash
+ ${lib.concatMapStringsSep "\n" (option: "set -o ${option}") bashOptions}
+ ''
+ + lib.optionalString (runtimeEnv != null) (
+ lib.concatStrings (
+ lib.mapAttrsToList (name: value: ''
+ ${lib.toShellVar name value}
+ export ${name}
+ '') runtimeEnv
+ )
+ )
+ + lib.optionalString (runtimeInputs != [ ]) ''
+
+ export PATH="${lib.makeBinPath runtimeInputs}${lib.optionalString inheritPath ":$PATH"}"
+ ''
+ + ''
+
+ ${text}
+ '';
+
+ checkPhase =
+ let
+ excludeFlags = lib.optionals (excludeShellChecks != [ ]) [
+ "--exclude"
+ (lib.concatStringsSep "," excludeShellChecks)
+ ];
+ # GHC (=> shellcheck) isn't supported on some platforms (such as risc-v)
+ # but we still want to use writeShellApplication on those platforms
+ shellcheckCommand = lib.optionalString shellcheck-minimal.compiler.bootstrapAvailable ''
+ # use shellcheck which does not include docs
+ # pandoc takes long to build and documentation isn't needed for just running the cli
+ ${lib.getExe shellcheck-minimal} ${
+ lib.escapeShellArgs (excludeFlags ++ extraShellCheckFlags)
+ } "$target"
+ '';
+ in
+ if checkPhase == null then
+ ''
+ runHook preCheck
+ #dryrun
+ ${dash}/bin/dash -n -O extglob "$target"
+ ${shellcheckCommand}
+ runHook postCheck
+ ''
+ else
+ checkPhase;
+};
diff --git a/package/default.nix b/package/default.nix
index 7b922db..40aba2c 100644
--- a/package/default.nix
+++ b/package/default.nix
@@ -241,8 +241,6 @@ in {
nvim-alias = pkgs.callPackage ./nvim-alias.nix {};
bolt-unpack = pkgs.callPackage ./bolt-unpack.nix {};
nvim-pager = pkgs.callPackage ./nvim-pager.nix {};
- printobstacle = pkgs.callPackage ./printobstacle.nix {};
- printprogress = pkgs.callPackage ./printprogress.nix {};
colorize = pkgs.callPackage ./colorize.nix {};
github-gh-tl = pkgs.callPackage ./github/gh-tl.nix {};
supabase-with-env-collection = pkgs.callPackage ./supabase-with-env-collection.nix {};
@@ -261,7 +259,7 @@ in {
"sentinèlla" = pkgs.callPackage (./. + "/sentinèlla") {};
shellplot = pkgs.callPackage ./shellplot {};
sops = pkgs.callPackage ./sops.nix {};
- onlinepubs2man = pkgs.callPackage ./onlinepubs2man {};
+ onlinepubs2man = pkgs.callPackage ./onlinepubs2man {};
pg-17-ext-hemar = buildHemarExt pkgs "17";
pg-17-ext-http = buildHttpExt pkgs "17";
pg-17-ext-smtp-client = buildSmtpExt pkgs "17";
diff --git a/package/printobstacle.nix b/package/printobstacle.nix
deleted file mode 100644
index 9b5fe2d..0000000
--- a/package/printobstacle.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{pkgs, ...}: let
- name = "printobstacle";
-in
- pkgs.writeShellScriptBin "${name}" ''
- printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
- ''
diff --git a/package/printprogress.nix b/package/printprogress.nix
deleted file mode 100644
index dd84a95..0000000
--- a/package/printprogress.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{pkgs, ...}: let
- name = "printprogress";
-in
- pkgs.writeShellScriptBin "${name}" ''
- printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}"
- ''
diff --git a/package/sentinèlla/base64.sh b/package/sentinèlla/base64.sh
new file mode 100644
index 0000000..e133626
--- /dev/null
+++ b/package/sentinèlla/base64.sh
@@ -0,0 +1,81 @@
+mod="${1:?}"
+
+case "$mod" in
+ encode)
+ printf '%s' "${2:?}" | od -An -t u1 | tr -s ' ' | tr -d '\n' | awk '
+ BEGIN {
+ A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+ }
+ function dec2bin(n, r,len,pad) {
+ if (n==0) return "00000000"
+ while (n>0) {
+ r = (n%2) r
+ n = int(n/2)
+ }
+ return sprintf("%08s", r)
+ }
+ function bin2dec(s, i,d,r) {
+ r=0
+ for(i=1;i<=length(s);i++) {
+ d=substr(s,i,1)
+ r = r*2 + d
+ }
+ return r
+ }
+ function buildbin(t, r) {
+ for(i=1;i<=NF;i+=1) {
+ #printf("%s | %s\n", dec2bin($i), $i)
+ r = sprintf("%s%s", r, dec2bin($i))
+ }
+ return r
+ }
+ function base64(b, r,c) {
+ for(i=1;i<=length(b);i+=6) {
+ #printf("%s | %s\n", substr(b,i,6), bin2dec(substr(b,i,6)))
+ c = substr(A, bin2dec(substr(b,i,6))+1, 1)
+ r = sprintf("%s%s", r, c)
+ }
+ return r
+ }
+ {
+ b=buildbin($1)
+ l=length(b)
+ lack = (6 - l % 6) % 6
+ for(i=1;i<=lack;i+=1) {
+ b = sprintf("%s0", b)
+ }
+ r = base64(b)
+ for(i=1;i<=lack/2;i+=1) {
+ r = sprintf("%s=", r)
+ }
+ print r
+ }
+ '
+ ;;
+ decode)
+ printf '%b\n' "$(printf '%s' "${2:?}" | awk ' BEGIN {
+ A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+ }
+ function dec2bin(n, r,len,pad) {
+ if (n==0) return "000000"
+ while (n>0) {
+ r = (n%2) r
+ n = int(n/2)
+ }
+ r = sprintf("%6s", r)
+ gsub(/ /,"0",r)
+ return r
+ }
+ {
+ for(i=1;i<=length($1);i+=1) {
+ b=sprintf("%s%s", b, dec2bin(index(A, substr($1,i,1))-1))
+ }
+ for(i=1; i<=length(b); i+=8){
+ n=0
+ for(j=0;j<8;j++) n = n*2 + (substr(b,i+j,1)=="1")
+ printf "\\x%02X", n
+ }
+ }
+ ')"
+ ;;
+esac
diff --git a/package/sentinèlla/default.nix b/package/sentinèlla/default.nix
index 2fd7b3a..92e0ca4 100644
--- a/package/sentinèlla/default.nix
+++ b/package/sentinèlla/default.nix
@@ -1,5 +1,11 @@
{ symlinkJoin, writeShellApplication, socat, dash, hectic, curl }:
let
+ base64 = writeShellApplication {
+ name = "base64";
+ runtimeInputs = [ ];
+ text = builtins.readFile ./base64.sh;
+ };
+
# TODO: writeDashApplication
probe = writeShellApplication {
name = "probe";
@@ -9,7 +15,7 @@ let
probe-loop = writeShellApplication {
name = "probe-loop";
- runtimeInputs = [ ];
+ runtimeInputs = [ base64 ];
text = builtins.readFile ./probe-loop.sh;
};
diff --git a/package/sentinèlla/probe-loop.sh b/package/sentinèlla/probe-loop.sh
index 1a4e801..66143e8 100644
--- a/package/sentinèlla/probe-loop.sh
+++ b/package/sentinèlla/probe-loop.sh
@@ -11,91 +11,6 @@
# TIMEOUT=5
# AUTH_FILE="/path/htpasswd-like" # lines: user:pass
-base64() {
- local mod
- mod="${1:?}"
-
- case "$mod" in
- encode)
- printf '%s' "${2:?}" | od -An -t u1 | tr -s ' ' | tr -d '\n' | awk '
- BEGIN {
- A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
- }
- function dec2bin(n, r,len,pad) {
- if (n==0) return "00000000"
- while (n>0) {
- r = (n%2) r
- n = int(n/2)
- }
- return sprintf("%08s", r)
- }
- function bin2dec(s, i,d,r) {
- r=0
- for(i=1;i<=length(s);i++) {
- d=substr(s,i,1)
- r = r*2 + d
- }
- return r
- }
- function buildbin(t, r) {
- for(i=1;i<=NF;i+=1) {
- #printf("%s | %s\n", dec2bin($i), $i)
- r = sprintf("%s%s", r, dec2bin($i))
- }
- return r
- }
- function base64(b, r,c) {
- for(i=1;i<=length(b);i+=6) {
- #printf("%s | %s\n", substr(b,i,6), bin2dec(substr(b,i,6)))
- c = substr(A, bin2dec(substr(b,i,6))+1, 1)
- r = sprintf("%s%s", r, c)
- }
- return r
- }
- {
- b=buildbin($1)
- l=length(b)
- lack = (6 - l % 6) % 6
- for(i=1;i<=lack;i+=1) {
- b = sprintf("%s0", b)
- }
- r = base64(b)
- for(i=1;i<=lack/2;i+=1) {
- r = sprintf("%s=", r)
- }
- print r
- }
- '
- ;;
- decode)
- printf '%b\n' "$(printf '%s' "${2:?}" | awk ' BEGIN {
- A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
- }
- function dec2bin(n, r,len,pad) {
- if (n==0) return "000000"
- while (n>0) {
- r = (n%2) r
- n = int(n/2)
- }
- r = sprintf("%6s", r)
- gsub(/ /,"0",r)
- return r
- }
- {
- for(i=1;i<=length($1);i+=1) {
- b=sprintf("%s%s", b, dec2bin(index(A, substr($1,i,1))-1))
- }
- for(i=1; i<=length(b); i+=8){
- n=0
- for(j=0;j<8;j++) n = n*2 + (substr(b,i+j,1)=="1")
- printf "\\x%02X", n
- }
- }
- ')"
- ;;
- esac
-}
-
: "${TIMEOUT:=5}"
: "${VOLUMES:=$(df -P | awk 'NR>1{print $6}')}"
diff --git a/package/sentinèlla/sentinel.sh b/package/sentinèlla/sentinel.sh
index 5619f5a..89ea249 100644
--- a/package/sentinèlla/sentinel.sh
+++ b/package/sentinèlla/sentinel.sh
@@ -1,3 +1,11 @@
#!/bin/dash
+TOKEN=8448534574:AAEvsdQqhUDu3RVRJWDGIVeqRmXlB0Dqn1Q
+CHAT_ID=380055934
+POLLING_INTERVAL_SEC=${POLLING_INTERVAL_SEC:-3}
+while true; do
+ curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
+ -d "chat_id=${CHAT_ID}" \
+ -d text="your message"
+done
diff --git a/plot.png b/plot.png
deleted file mode 100644
index 92bfa0e..0000000
Binary files a/plot.png and /dev/null differ