# $Id$
PREFIX := /usr/local
-MODULE_PREFIX := $(PREFIX)/lib/mandshurica
+MODULE_PREFIX := $(PREFIX)/lib/mandshurica/module
WEBROOT_PREFIX := $(PREFIX)/lib/mandshurica/webroot
PROJECTS_PREFIX := $(PREFIX)/lib/mandshurica/projects
TOOL_PREFIX := $(PREFIX)/lib/mandshurica/tool
echo done; \
done
+install: all
+ mkdir -p $(PREFIX) $(MODULE_PREFIX) $(WEBROOT_PREFIX) $(PROJECTS_PREFIX) $(TOOL_PREFIX) $(PREFIX)/etc $(PREFIX)/bin $(PREFIX)/lib/mandshurica/db
+ touch $(PREFIX)/lib/mandshurica/db/auth.db $(PREFIX)/lib/mandshurica/db/login.db $(PREFIX)/lib/mandshurica/db/project.db
+ ./Mandshurica/mandshurica --create $(PREFIX)/etc/mandshurica.conf
+ $(MAKE) -C ./Mandshurica install PREFIX="$(PREFIX)" MODULE_PREFIX="$(MODULE_PREFIX)" PROJECTS_PREFIX="$(PROJECTS_PREFIX)" TOOL_PREFIX="$(TOOL_PREFIX)" WEBROOT_PREFIX="$(WEBROOT_PREFIX)"
+ $(MAKE) -C ./Module install PREFIX="$(PREFIX)" MODULE_PREFIX="$(MODULE_PREFIX)" PROJECTS_PREFIX="$(PROJECTS_PREFIX)" TOOL_PREFIX="$(TOOL_PREFIX)" WEBROOT_PREFIX="$(WEBROOT_PREFIX)"
+ $(MAKE) -C ./Tool install PREFIX="$(PREFIX)" MODULE_PREFIX="$(MODULE_PREFIX)" PROJECTS_PREFIX="$(PROJECTS_PREFIX)" TOOL_PREFIX="$(TOOL_PREFIX)" WEBROOT_PREFIX="$(WEBROOT_PREFIX)"
+ $(MAKE) -C ./Webroot install PREFIX="$(PREFIX)" MODULE_PREFIX="$(MODULE_PREFIX)" PROJECTS_PREFIX="$(PROJECTS_PREFIX)" TOOL_PREFIX="$(TOOL_PREFIX)" WEBROOT_PREFIX="$(WEBROOT_PREFIX)"
+
clean:
$(MAKE) -C ./Mandshurica clean
$(MAKE) -C ./Module clean
EXTRA_LDFLAGS =
EXTRA_LIBS = -pthread -lcrypto
-.PHONY: all clean
+.PHONY: all clean install
ifeq ($(shell uname -s),Linux)
EXTRA_LIBS += -ldl
./%.o: ./%.c ./mandshurica%.h
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+install:
+ cp ./mandshurica $(PREFIX)/bin/
+
clean:
rm -f ./mandshurica ./*.o
if(value[0] == '/') {
path = mandshurica_strdup(value);
} else {
- path = mandshurica_strcat3(server_root, "/", value);
+ path = mandshurica_strcat3(server_root, "/lib/mandshurica/module/", value);
}
void* lib = dlopen(path, RTLD_LAZY);
if(lib != NULL) {
fprintf(f, "# Generated by Mandshurica " MANDSHURICA_VERSION "\n");
fprintf(f, "ServerRoot %s\n", PREFIX);
fprintf(f, "\n");
- fprintf(f, "Set LoginDB %s/login.db\n", PREFIX);
- fprintf(f, "Set CookieDB %s/cookie.db\n", PREFIX);
- fprintf(f, "Set ProjectDB %s/project.db\n", PREFIX);
+ fprintf(f, "Set AuthDB %s/lib/mandshurica/db/auth.db\n", PREFIX);
+ fprintf(f, "Set LoginDB %s/lib/mandshurica/db/login.db\n", PREFIX);
+ fprintf(f, "Set ProjectDB %s/lib/mandshurica/db/project.db\n", PREFIX);
fprintf(f, "Set HTTPPort 1024\n");
fprintf(f, "Set HTTPRoot %s\n", WEBROOT_PREFIX);
fprintf(f, "Set HTMLManage %s/html-manage\n", TOOL_PREFIX);
EXTRA_LDFLAGS = -shared
EXTRA_LIBS =
-.PHONY: all clean
+.PHONY: all clean install
ifeq ($(shell uname -s),Linux)
EXTRA_LIBS += -ldl
./%.o: ./%.c ../Mandshurica/mandshurica.h
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+install:
+ cp *.so $(MODULE_PREFIX)/
+
clean:
rm -f *.so *.o
config = _config;
config->mandshurica_log(MS_INFO, "Cookie authentication Module init");
- char* db = config->mandshurica_get_param("CookieDB");
+ char* db = config->mandshurica_get_param("AuthDB");
if(db == NULL) {
- config->mandshurica_log(MS_ERROR, "Cookie authentication Database path is not set!");
+ config->mandshurica_log(MS_ERROR, "Cookie authentication Database path is not set! (AuthDB)");
return 1;
}
config->mandshurica_log(MS_INFO, log);
free(log);
+ db = config->mandshurica_get_param("LoginDB");
+
+ if(db == NULL) {
+ config->mandshurica_log(MS_ERROR, "Cookie token Database path is not set! (LoginDB)");
+ return 1;
+ }
+
+ log = mandshurica_strcat("Cookie token Database is ", db);
+ config->mandshurica_log(MS_INFO, log);
+ free(log);
+
return 0;
}
}
if(login) {
*ptr = NULL;
- struct ms_db* db = mandshurica_db_open(config->mandshurica_get_param("CookieDB"));
+ struct ms_db* db = mandshurica_db_open(config->mandshurica_get_param("AuthDB"));
if(db != NULL) {
char* pwd = mandshurica_db_get(db, username);
if(pwd == NULL) {
EXTRA_LDFLAGS =
EXTRA_LIBS =
-.PHONY: all clean
+.PHONY: all clean install
all: ./html-manage
./db.o: ../Mandshurica/db.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
-
+
+install:
+ cp ./html-manage $(TOOL_PREFIX)/
+
clean:
rm -f ./html-manage *.o
# $Id$
+.PHONY: install
+
+install:
+ cp -rf * $(WEBROOT_PREFIX)/
+ rm $(WEBROOT_PREFIX)/GNUmakefile
--- /dev/null
+<!--@chdir_webroot@
+vim: syntax=html
+-->
+@include head-start.html@
+<title>Mandshurica - Manage</title>
+@include body-start.html@
+<h1>Mandshurica - Manage</h1>
+@include bar.html@
+@ifnot login@
+You are not authorized to see this page. <a href="/login">Login</a>?
+@endif@
+@if login@
+Manage your projects here.<br>
+@exec $Config_HTMLManage $Config_ProjectDB@
+@endif@
+@include end.html@