diff --git a/inc/lektor/config.h b/inc/lektor/config.h index 52f5de2cbd08b79a7018b3dc0877abc40e619f88..75aaced78226f816388555dae0994c879fafdb93 100644 --- a/inc/lektor/config.h +++ b/inc/lektor/config.h @@ -22,9 +22,9 @@ static const char *const lkt_default_config_file = "\n" "; Database configuration.\n" "[database]\n" - "kara_dir = /home/kara ; Root for the mkv files\n" - "db_path = /home/kara/kara.db ; Sqlite3 database, must be rw\n" - "init_script = /opt/lektor/init.sql ; Init script for the database\n" + "kara_dir = /home/kara ; Root for the mkv files\n" + "db_path = /home/kara/kara.db ; Sqlite3 database, must be rw\n" + "init_script = LKT_PREFIX/share/lektor/init.sql ; Init script for the database\n" "\n" "; Player configuration, the window where the karas\n" "; can be seen.\n" @@ -38,20 +38,14 @@ static const char *const lkt_default_config_file = "\n" "; The WinX11 module configuration. Modules are .so files\n" "; loaded by lektor.\n" - "[module_winx11]\n" - "path = /opt/lektor/modules/lib_module_x11.so\n" + "[module_x11]\n" + "path = LKT_PREFIX/lib/lektor/lib_module_x11.so\n" "load_function = module_set_function\n" "xwallpaper = false\n" "\n" - "; Dummy module. A module is a .so file. two option must be\n" - "; present: the 'path' option which indicate the .so file to load.\n" - "; and the 'load_function' which is the name of the function used\n" - "; to load the module correctly.\n" - "[module_dummy]\n" - "path = /some/path/to/file.so\n" - "load_function = foo\n" - "specific_opt1 = 1\n" - "specific_opt2 = a string\n"; + "[module_sdl2]\n" + "path = LKT_PREFIX/lib/lektor/lib_module_sdl2.so\n" + "load_function = module_set_function\n"; /* It is just an alias to the consecutive use of config_detect_file and config_new function, with the return an '&&' between the two returns of the diff --git a/scripts/install.sh b/scripts/install.sh index 6efd75972b41275542d2f566d307020aeb617d41..213e4d297b180ad3dd690cbb977f0053e75a6872 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,14 +2,17 @@ # Usefull things alias die='exit 1' +if [[ $OSTYPE == "linux-gnu" ]] ; then alias sed="sed -i" ; fi +if [[ $OSTYPE == "darwin" ]] || [[ $OSTYPE == "freebsd"* ]] ; then alias sed="sed -i ''" ; fi +LKT_INI=$MESON_INSTALL_PREFIX/etc/lektor.ini # Verify lktadm LKTADM=$MESON_INSTALL_PREFIX/bin/lktadm -type $LKTADM +type $LKTADM &>/dev/null [ $? -ne 0 ] && echo "$LKTADM not found" && exit 1 # Install files -$LKTADM conf > $MESON_INSTALL_PREFIX/etc/lektor.ini || die -mkdir /home/kara || echo '/home/kara already exists' -echo -ne "Enter the name of the user that will launch lektor: " +$LKTADM conf > $LKT_INI || die +sed "s+LKT_PREFIX+$MESON_INSTALL_PREFIX+g" $LKT_INI || die +mkdir /home/kara >&/dev/null || echo '/home/kara already exists' $LKTADM init database || die diff --git a/src/config.c b/src/config.c index 5df978b5ab42d01a0f44ab72695963bc9c7e404d..0568353ecc6664f43f9abc37dd8271851d0a61e7 100644 --- a/src/config.c +++ b/src/config.c @@ -124,7 +124,7 @@ config_detect_file(char *conf, size_t conf_len) if (getcwd(conf, conf_len - 1) != NULL) { strncat(conf, "/lektor.ini", conf_len - 1); fprintf(stderr, " . config_detect_file: trying %s\n", conf); - if (!access(conf, R_OK)) + if (!access(conf, R_OK | F_OK)) goto found; } @@ -146,23 +146,23 @@ no_config_directory: /* Try the '/opt/lektor' file. */ memcpy(conf, "/opt/lektor/lektor.ini", sizeof("/opt/lektor/lektor.ini")); fprintf(stderr, " . config_detect_file: trying %s\n", conf); - if (!access(conf, R_OK)) + if (!access(conf, R_OK | F_OK)) goto found; /* Try the '/usr/local/etc/lektor.ini' file. */ - memcpy(conf, "/usr/local/etc/lektor.ini", sizeof("/opt/lektor/lektor.ini")); + memcpy(conf, "/usr/local/etc/lektor.ini", sizeof("/usr/local/etc/lektor.ini")); fprintf(stderr, " . config_detect_file: trying %s\n", conf); - if (!access(conf, R_OK)) + if (!access(conf, R_OK | F_OK)) goto found; /* Try the '/etc/lektor.ini' file. */ memcpy(conf, "/etc/lektor.ini", sizeof("/etc/lektor.ini")); fprintf(stderr, " . config_detect_file: trying %s\n", conf); - if (!access(conf, R_OK)) + if (!access(conf, R_OK | F_OK)) goto found; /* Error */ - fprintf(stderr, "config_detect_file: an error occured with file %s: %s", + fprintf(stderr, " ! config_detect_file: an error occured with file %s: %s\n", conf, strerror(errno)); if (is_malloc) free(conf); diff --git a/src/main/lktadm.c b/src/main/lktadm.c index f43d40c28a220f563898e39caa91ef846e29a500..16b819a2ddec487dc3f6bede66f14dd83efc805d 100644 --- a/src/main/lktadm.c +++ b/src/main/lktadm.c @@ -219,6 +219,7 @@ init_database__(struct lkt_cmd_args *args) (void) args; pid_t pid; int wstatus, status, fd; + open_db(); char *sqlite_args[] = { sqlite3_bin, db_path }; if ((pid = fork()) == 0) {