This commit is contained in:
Laura Hausmann 2020-07-22 12:38:14 +02:00
parent eb87026f32
commit 6b82bc6d12
Signed by: zotan
GPG Key ID: 5EC1D38FFC321311
1 changed files with 7 additions and 4 deletions

View File

@ -14,6 +14,9 @@ namespace repomgr {
public static RepoMgr Repo; public static RepoMgr Repo;
public static void Main(string[] args) { public static void Main(string[] args) {
if (args.Length < 2 || args[1].Equals("help"))
PrintHelp();
if (File.Exists("/tmp/repomgr.lock") && args[1] != "daemon") { if (File.Exists("/tmp/repomgr.lock") && args[1] != "daemon") {
Console.WriteLine("/tmp/repomgr.lock exists, delete it if you are sure no other process is running"); Console.WriteLine("/tmp/repomgr.lock exists, delete it if you are sure no other process is running");
Environment.Exit(1); Environment.Exit(1);
@ -22,12 +25,10 @@ namespace repomgr {
File.Create("/tmp/repomgr.lock"); File.Create("/tmp/repomgr.lock");
} }
if (args.Length < 2 || args[1].Equals("help"))
PrintHelp();
Repo = new RepoMgr(args[0]); Repo = new RepoMgr(args[0]);
if (File.Exists(Path.Combine(args[0], "repomgr.index.json"))) if (File.Exists(Path.Combine(args[0], "repomgr.index.json")))
Repo.ReadIndex(); Repo.ReadIndex();
switch (args[1]) { switch (args[1]) {
case "daemon": case "daemon":
CreateHostBuilder(args).Build().Run(); CreateHostBuilder(args).Build().Run();
@ -130,7 +131,6 @@ namespace repomgr {
} }
private static void PrintHelp() { private static void PrintHelp() {
//TODO: add/remove <package> [...]
Console.WriteLine("Usage:"); Console.WriteLine("Usage:");
Console.WriteLine("repomgr <data-path> init <repo-path> <reponame>"); Console.WriteLine("repomgr <data-path> init <repo-path> <reponame>");
Console.WriteLine("repomgr <data-path> list"); Console.WriteLine("repomgr <data-path> list");
@ -140,6 +140,9 @@ namespace repomgr {
Console.WriteLine("repomgr <data-path> update <package> [...] [-f] [--skip-checks]"); Console.WriteLine("repomgr <data-path> update <package> [...] [-f] [--skip-checks]");
Console.WriteLine("repomgr <data-path> update-all"); Console.WriteLine("repomgr <data-path> update-all");
Console.WriteLine("repomgr <data-path> daemon"); Console.WriteLine("repomgr <data-path> daemon");
if (File.Exists("/tmp/repomgr.lock"))
File.Delete("/tmp/repomgr.lock");
Environment.Exit(0);
} }
public static IHostBuilder CreateHostBuilder(string[] args) => public static IHostBuilder CreateHostBuilder(string[] args) =>