mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
Installation improvements (auto-creation of data directories)
This commit is contained in:
parent
72a0f04a67
commit
90aca9cd5c
3 changed files with 33 additions and 18 deletions
15
Makefile
15
Makefile
|
@ -6,16 +6,18 @@ CONFIG = $(DESTDIR)$(SYSCONFDIR)
|
|||
MODULES = $(DESTDIR)$(PREFIX)/lib/prosody/modules
|
||||
SOURCE = $(DESTDIR)$(PREFIX)/lib/prosody
|
||||
|
||||
DATADIR?=data
|
||||
|
||||
INSTALLEDSOURCE = $(PREFIX)/lib/prosody
|
||||
INSTALLEDCONFIG = $(SYSCONFDIR)
|
||||
INSTALLEDMODULES = $(PREFIX)/lib/prosody/modules
|
||||
INSTALLEDDATA = $(DATADIR)
|
||||
|
||||
|
||||
all:
|
||||
all: prosody.install prosody.cfg.lua.install
|
||||
$(MAKE) all -C util-src
|
||||
|
||||
install: prosody.install prosody.cfg.lua.install util/encodings.so util/encodings.so
|
||||
install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
|
||||
install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE) $(DATADIR)
|
||||
install -d $(CONFIG)/certs
|
||||
install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
|
||||
install ./prosody.install $(BIN)/prosody
|
||||
|
@ -40,7 +42,12 @@ util/hashes.so:
|
|||
$(MAKE) install -C util-src
|
||||
|
||||
prosody.install: prosody
|
||||
sed "s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|;s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|;s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" prosody > prosody.install
|
||||
cp prosody prosody.install
|
||||
sed -i "s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|;" prosody.install
|
||||
sed -i "s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|;" prosody.install
|
||||
sed -i "s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|;" prosody.install
|
||||
# The trailing slash is intentional in this one
|
||||
sed -i "s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" prosody.install
|
||||
|
||||
prosody.cfg.lua.install:
|
||||
sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > prosody.cfg.lua.install
|
||||
|
|
18
configure
vendored
18
configure
vendored
|
@ -4,13 +4,14 @@
|
|||
|
||||
PREFIX=/usr/local
|
||||
SYSCONFDIR="$PREFIX/etc/prosody"
|
||||
DATADIR="$PREFIX/var/lib/prosody"
|
||||
LUA_SUFFIX=""
|
||||
LUA_DIR="/usr"
|
||||
LUA_BINDIR="/usr/bin"
|
||||
LUA_INCDIR="/usr/include"
|
||||
LUA_LIBDIR="/usr/lib"
|
||||
IDN_LIB=idn
|
||||
OPENSSL_LIB=ssl
|
||||
OPENSSL_LIB=crypto
|
||||
|
||||
# Help
|
||||
|
||||
|
@ -23,6 +24,8 @@ Configure Prosody prior to building.
|
|||
Default is $PREFIX
|
||||
--sysconfdir=DIR Location where the config file should be installed.
|
||||
Default is \$PREFIX/etc/prosody
|
||||
--datadir=DIR Location where the server data should be stored.
|
||||
Default is \$PREFIX/var/lib/prosody
|
||||
--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
|
||||
Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
|
||||
--with-lua=PREFIX Use Lua from given prefix.
|
||||
|
@ -60,6 +63,10 @@ do
|
|||
PREFIX="$value"
|
||||
PREFIX_SET=yes
|
||||
;;
|
||||
--data-dir=*)
|
||||
DATADIR="$value"
|
||||
DATADIR_SET=yes
|
||||
;;
|
||||
--require-config)
|
||||
REQUIRE_CONFIG=yes
|
||||
;;
|
||||
|
@ -100,6 +107,14 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ "$PREFIX_SET" = "yes" -a ! "$DATADIR_SET" = "yes" ]
|
||||
then
|
||||
if [ "$PREFIX" = "/usr" ]
|
||||
then DATADIR=/var/lib/prosody
|
||||
else DATADIR=$PREFIX/var/lib/prosody
|
||||
fi
|
||||
fi
|
||||
|
||||
find_program() {
|
||||
path="$PATH"
|
||||
item="`echo "$path" | sed 's/\([^:]*\):.*/\1/'`"
|
||||
|
@ -221,6 +236,7 @@ cat <<EOF > config.unix
|
|||
|
||||
PREFIX=$PREFIX
|
||||
SYSCONFDIR=$SYSCONFDIR
|
||||
DATADIR=$DATADIR
|
||||
LUA_SUFFIX=$LUA_SUFFIX
|
||||
LUA_DIR=$LUA_DIR
|
||||
LUA_INCDIR=$LUA_INCDIR
|
||||
|
|
18
prosody
18
prosody
|
@ -5,28 +5,20 @@
|
|||
CFG_SOURCEDIR=nil;
|
||||
CFG_CONFIGDIR=nil;
|
||||
CFG_PLUGINDIR=nil;
|
||||
CFG_DATADIR=nil;
|
||||
|
||||
-- -- -- -- -- --
|
||||
|
||||
if CFG_SOURCEDIR then
|
||||
if os.getenv("HOME") then
|
||||
CFG_SOURCEDIR = CFG_SOURCEDIR:gsub("^~", os.getenv("HOME"));
|
||||
end
|
||||
package.path = CFG_SOURCEDIR.."/?.lua;"..package.path
|
||||
package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath
|
||||
end
|
||||
|
||||
if CFG_CONFIGDIR then
|
||||
if CFG_DATADIR then
|
||||
if os.getenv("HOME") then
|
||||
CFG_CONFIGDIR = CFG_CONFIGDIR:gsub("^~", os.getenv("HOME"));
|
||||
CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME"));
|
||||
end
|
||||
end
|
||||
|
||||
if CFG_PLUGINDIR then
|
||||
if os.getenv("HOME") then
|
||||
CFG_PLUGINDIR = CFG_PLUGINDIR:gsub("^~", os.getenv("HOME"));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Required to be able to find packages installed with luarocks
|
||||
pcall(require, "luarocks.require")
|
||||
|
@ -56,7 +48,7 @@ do
|
|||
end
|
||||
end
|
||||
|
||||
local data_path = config.get("*", "core", "data_path") or "data";
|
||||
local data_path = config.get("*", "core", "data_path") or CFG_DATADIR or "data";
|
||||
local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end
|
||||
local _mkdir = {}
|
||||
function mkdir(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue