termux-packages/packages/algernon/fix-hardcoded-paths.patch

74 lines
3.4 KiB
Diff

diff -uNr algernon-1.12.3/engine/config.go algernon-1.12.3.mod/engine/config.go
--- algernon-1.12.3/engine/config.go 2019-02-19 17:14:55.000000000 +0200
+++ algernon-1.12.3.mod/engine/config.go 2019-02-25 19:41:17.564347427 +0200
@@ -273,16 +273,16 @@
defaultLimitString: strconv.Itoa(10),
// Default Bolt database file, for some operating systems
- defaultBoltFilename: "/tmp/algernon.db",
+ defaultBoltFilename: "@TERMUX_PREFIX@/tmp/algernon.db",
// Default log file, for some operating systems
- defaultLogFile: "/tmp/algernon.log",
+ defaultLogFile: "@TERMUX_PREFIX@/var/log/algernon.log",
// Default filename for a Lua script that provides data to a template
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,
diff -uNr algernon-1.12.3/engine/flags.go algernon-1.12.3.mod/engine/flags.go
--- algernon-1.12.3/engine/flags.go 2019-02-19 17:14:55.000000000 +0200
+++ algernon-1.12.3.mod/engine/flags.go 2019-02-25 19:42:16.171195391 +0200
@@ -300,9 +300,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:
diff -uNr algernon-1.12.3/engine/mime.go algernon-1.12.3.mod/engine/mime.go
--- algernon-1.12.3/engine/mime.go 2019-02-19 17:14:55.000000000 +0200
+++ algernon-1.12.3.mod/engine/mime.go 2019-02-25 19:42:57.227988150 +0200
@@ -6,5 +6,5 @@
func (ac *Config) initializeMime() {
// 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)
}
diff -uNr algernon-1.12.3/vendor/github.com/go-sql-driver/mysql/dsn.go algernon-1.12.3.mod/vendor/github.com/go-sql-driver/mysql/dsn.go
--- algernon-1.12.3/vendor/github.com/go-sql-driver/mysql/dsn.go 2019-02-19 17:14:55.000000000 +0200
+++ algernon-1.12.3.mod/vendor/github.com/go-sql-driver/mysql/dsn.go 2019-02-25 20:31:01.069051948 +0200
@@ -88,7 +88,7 @@
case "tcp":
cfg.Addr = "127.0.0.1:3306"
case "unix":
- cfg.Addr = "/tmp/mysql.sock"
+ cfg.Addr = "@TERMUX_PREFIX@/tmp/mysql.sock"
default:
return errors.New("default addr for network '" + cfg.Net + "' unknown")
}
diff -uNr algernon-1.12.3/vendor/github.com/xyproto/gopher-lua/utils.go algernon-1.12.3.mod/vendor/github.com/xyproto/gopher-lua/utils.go
--- algernon-1.12.3/vendor/github.com/xyproto/gopher-lua/utils.go 2019-02-19 17:14:55.000000000 +0200
+++ algernon-1.12.3.mod/vendor/github.com/xyproto/gopher-lua/utils.go 2019-02-25 20:30:26.585626361 +0200
@@ -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"