package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
|
|
"PackageManager/Client/Database"
|
|
"PackageManager/Client/Filesystem"
|
|
"PackageManager/Client/Package"
|
|
"PackageManager/Color"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
updateFilesytemFlag bool
|
|
updateFilesytemFlagLong bool
|
|
createPackageFlag bool
|
|
createPackageFlagLong bool
|
|
|
|
e error
|
|
)
|
|
|
|
e = Database.InitDB()
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
|
|
// Initialise flags
|
|
flag.BoolVar(&updateFilesytemFlag, "Uf", false, "Update filesystem database")
|
|
flag.BoolVar(&updateFilesytemFlagLong, "update-filesystem", false, "Update filesystem database")
|
|
|
|
flag.BoolVar(&createPackageFlag, "Cp", false, "Create package")
|
|
flag.BoolVar(&createPackageFlagLong, "create-package", false, "Create Package")
|
|
|
|
flag.Parse()
|
|
|
|
if updateFilesytemFlag || updateFilesytemFlagLong {
|
|
e = Filesystem.UpdateFilesystemHash()
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
if createPackageFlag || createPackageFlagLong {
|
|
e = Package.CreatePackage()
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
return
|
|
}
|
|
|
|
flag.Usage()
|
|
fmt.Println(Color.Fatal("Nothing to do"))
|
|
|
|
//e := Archive.TarGzip("/tmp/test", "/tmp/test.tar.gz")
|
|
//e := Archive.UntarGzip("/tmp/test.tar.gz", "/tmp/test")
|
|
//fmt.Println(e)
|
|
}
|