fix typo, add lock file
This commit is contained in:
parent
d30b122c6f
commit
c3aabf6f5a
19
Program.cs
19
Program.cs
|
@ -13,8 +13,19 @@ namespace repomgr
|
|||
public static class Program
|
||||
{
|
||||
public static RepoMgr Repo;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (File.Exists("/tmp/repomgr.lock"))
|
||||
{
|
||||
Console.WriteLine("/tmp/repomgr.lock exists, delete if you are sure that this is the only instance");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Create("/tmp/repomgr.lock");
|
||||
}
|
||||
|
||||
if (args.Length < 2 || args[1].Equals("help"))
|
||||
PrintHelp();
|
||||
Repo = new RepoMgr(args[0]);
|
||||
|
@ -36,6 +47,7 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("Init failed with error: " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
case "add":
|
||||
if (args.Length != 3)
|
||||
|
@ -48,6 +60,7 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("Add failed with error: " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
case "update":
|
||||
if (args.Length < 3 || args.Length > 4)
|
||||
|
@ -71,6 +84,7 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("Build failed with error: " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
case "update-all":
|
||||
if (args.Length != 2)
|
||||
|
@ -83,6 +97,7 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("BuildAll failed with error: " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
case "remove":
|
||||
if (args.Length != 3)
|
||||
|
@ -95,6 +110,7 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("Remove failed with error: " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
case "list":
|
||||
if (args.Length != 2)
|
||||
|
@ -107,11 +123,14 @@ namespace repomgr
|
|||
{
|
||||
Console.WriteLine("List failed with error " + e);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
PrintHelp();
|
||||
break;
|
||||
}
|
||||
|
||||
File.Delete("/tmp/repomgr.lock");
|
||||
}
|
||||
|
||||
private static void PrintHelp()
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace repomgr
|
|||
}
|
||||
catch (IOException)
|
||||
{
|
||||
throw new Exception("Unable to write configuratoin. Check permissions.");
|
||||
throw new Exception("Unable to write configuration. Check permissions.");
|
||||
}
|
||||
}
|
||||
private bool CheckPackage(string package)
|
||||
|
|
Loading…
Reference in New Issue