diff --git a/modules/contrib/cryptpad/main.mcl b/modules/contrib/cryptpad/main.mcl new file mode 100644 index 00000000..b3b4f4fd --- /dev/null +++ b/modules/contrib/cryptpad/main.mcl @@ -0,0 +1,51 @@ +import "fmt" + +class deploy() { + + $pkgname = "cryptpad" + $installdir = "/opt/" + $gitbranch = "2025.3.1-rc" + $gitclonecommand = fmt.printf("git clone -b %s --depth 1 https://github.com/cryptpad/cryptpad.git %s", $gitbranch, $pkgname) + $shell = "/bin/bash" + + exec "cryptpad-fetch" { + cwd => $installdir, + + ifshell => $shell, + ifcmd => fmt.printf("test ! -d %s%s", $installdir, $pkgname), + + shell => $shell, + cmd => $gitclonecommand, + } + + exec "cryptpad-install" { + cwd => fmt.printf("%s%s", $installdir, $pkgname), + + ifshell => $shell, + ifcmd => fmt.printf("test -d %s%s", $installdir, $pkgname), + + shell => $shell, + cmd => "npm install && npm run install:components", + + Depend => Exec["cryptpad-fetch"], + } + + file "/opt/cryptpad/config/config.js" { + source => "/opt/cryptpad/config/config.example.js", + state => "exists", + + Depend => Exec["cryptpad-install"], + } + + exec "cryptpad-run" { + cwd => fmt.printf("%s%s", $installdir, $pkgname), + + ifshell => $shell, + ifcmd => fmt.printf("test -d %s%s", $installdir, $pkgname), + + shell => $shell, + cmd => "npm run dev", + + Depend => File["/opt/cryptpad/config/config.js"], + } +} diff --git a/modules/contrib/cryptpad/metadata.yaml b/modules/contrib/cryptpad/metadata.yaml new file mode 100644 index 00000000..e69de29b