diff --git a/completion/bash-completion b/completion/bash-completion index dd1e5b29..22d5f748 100644 --- a/completion/bash-completion +++ b/completion/bash-completion @@ -145,7 +145,7 @@ __complete_install() { __complete_update() { opts="-c -v -q -b -i -I -e -w" - lopts="--create-metadata --verbose --quiet --buildreport + lopts="--create-metadata --create-key --verbose --quiet --buildreport --interactive --icons --editor --wiki --pretty --clean --delete-unknown --nosign --rename-apks --use-date-from-apk" case "${prev}" in diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 815cf3eb..a39b671a 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -239,8 +239,8 @@ def read_config(opts, config_file='config.py'): with io.open(config_file, "rb") as f: code = compile(f.read(), config_file, 'exec') exec(code, None, config) - elif len(get_local_metadata_files()) == 0: - raise FDroidException("Missing config file - is this a repo directory?") + else: + logging.debug("No config.py found - using defaults.") for k in ('mirrors', 'install_list', 'uninstall_list', 'serverwebroot', 'servergitroot'): if k in config: @@ -2315,7 +2315,10 @@ def write_to_config(thisconfig, key, value=None, config_file=None): value = thisconfig[origkey] if origkey in thisconfig else thisconfig[key] cfg = config_file if config_file else 'config.py' - # load config file + # load config file, create one if it doesn't exist + if not os.path.exists(cfg): + os.mknod(cfg) + logging.info("Creating empty " + cfg) with open(cfg, 'r', encoding="utf-8") as f: lines = f.readlines() diff --git a/tests/run-tests b/tests/run-tests index 2cfdc55a..608c1e2e 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -185,7 +185,6 @@ echo_header 'copy git import and run `fdroid scanner` on it' REPOROOT=`create_test_dir` cd $REPOROOT -touch config.py cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/ mkdir metadata echo "Auto Name:Just A Test" > metadata/org.fdroid.ci.test.app.txt @@ -526,7 +525,6 @@ echo_header "test metadata checks" REPOROOT=`create_test_dir` cd $REPOROOT -touch config.py mkdir repo cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/ @@ -828,7 +826,6 @@ echo_header "setup a new repo manually and generate a keystore" REPOROOT=`create_test_dir` KEYSTORE=$REPOROOT/keystore.jks cd $REPOROOT -touch config.py cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/ ! test -e $KEYSTORE set +e @@ -895,7 +892,6 @@ echo_header "setup a new repo with no keystore, add APK, and update" REPOROOT=`create_test_dir` KEYSTORE=$REPOROOT/keystore.jks cd $REPOROOT -touch config.py touch fdroid-icon.png mkdir repo cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/