0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 00:10:52 +00:00
termux-packages/packages/algernon/fix-hardcoded-paths.patch
2024-06-28 11:47:35 +02:00

75 lines
2.6 KiB
Diff

--- a/engine/config.go
+++ b/engine/config.go
@@ -154,7 +154,7 @@
// New creates a new server configuration based using the default values
func New(versionString, description string) (*Config, error) {
- tmpdir := env.Str("TMPDIR", "/tmp")
+ tmpdir := env.Str("TMPDIR", "@TERMUX_PREFIX@/tmp")
ac := &Config{
curlSupport: true,
@@ -187,7 +187,7 @@
defaultLuaDataFilename: "data.lua",
// List of configuration filenames to check
- serverConfigurationFilenames: []string{"/etc/algernon/serverconf.lua", "/etc/algernon/server.lua"},
+ serverConfigurationFilenames: []string{"@TERMUX_PREFIX@/etc/algernon/serverconf.lua", "@TERMUX_PREFIX@/etc/algernon/server.lua"},
// Compression speed over compactness
cacheCompressionSpeed: true,
@@ -218,7 +218,7 @@
return nil, err
}
// Read in the mimetype information from the system. Set UTF-8 when setting Content-Type.
- ac.mimereader = mime.New("/etc/mime.types", true)
+ ac.mimereader = mime.New("@TERMUX_PREFIX@/etc/mime.types", true)
ac.setupLogging()
// File stat cache
--- a/engine/flags.go
+++ b/engine/flags.go
@@ -206,9 +206,9 @@
switch {
case ac.productionMode:
// Use system directories
- ac.serverDirOrFilename = "/srv/algernon"
- ac.serverCert = "/etc/algernon/cert.pem"
- ac.serverKey = "/etc/algernon/key.pem"
+ ac.serverDirOrFilename = "@TERMUX_PREFIX@/var/lib/algernon"
+ ac.serverCert = "@TERMUX_PREFIX@/etc/algernon/cert.pem"
+ ac.serverKey = "@TERMUX_PREFIX@/etc/algernon/key.pem"
ac.cacheMode = cachemode.Production
ac.serverMode = true
case ac.devMode:
--- a/engine/serve.go
+++ b/engine/serve.go
@@ -167,7 +167,7 @@
// If $XDG_CONFIG_DIR is not set, use $HOME.
// If $HOME is not set, use $TMPDIR.
// If $TMPDIR is not set, use /tmp.
- certStorageDir := env.StrAlt("XDG_CONFIG_DIR", "HOME", env.Str("TMPDIR", "/tmp"))
+ certStorageDir := env.StrAlt("XDG_CONFIG_DIR", "HOME", env.Str("TMPDIR", "@TERMUX_PREFIX@/tmp"))
defaultEmail := env.Str("LOGNAME", "root") + "@localhost"
if len(ac.certMagicDomains) > 0 {
--- a/vendor/github.com/caddyserver/certmagic/dnsutil.go
+++ b/vendor/github.com/caddyserver/certmagic/dnsutil.go
@@ -339,4 +339,4 @@
fqdnSOACacheMu sync.Mutex
)
-const defaultResolvConf = "/etc/resolv.conf"
+const defaultResolvConf = "@TERMUX_PREFIX@/etc/resolv.conf"
--- a/vendor/github.com/xyproto/gopher-lua/utils.go
+++ b/vendor/github.com/xyproto/gopher-lua/utils.go
@@ -156,7 +156,7 @@
}
func popenArgs(arg string) (string, []string) {
- cmd := "/bin/sh"
+ cmd := "@TERMUX_PREFIX@/bin/sh"
args := []string{"-c"}
if LuaOS == "windows" {
cmd = "C:\\Windows\\system32\\cmd.exe"