[sources] Add support for --sources-md5 and --sources-cpio flags.

This commit is contained in:
Ciprian Dorin Craciun 2022-09-02 15:27:11 +03:00
parent 5077ac0c22
commit c889c90c5b
4 changed files with 51 additions and 6 deletions

View file

@ -1258,7 +1258,15 @@ func Main () () {
switch os.Args[1] { switch os.Args[1] {
case "version", "--version", "-v" : case "version", "--version", "-v" :
version.Main ("kawipiko-archiver") version.Main ("kawipiko-archiver", "version")
return
case "--sources-md5" :
version.Main ("kawipiko-archiver", "sources.md5")
return
case "--sources-cpio" :
version.Main ("kawipiko-archiver", "sources.cpio")
return return
case "--help", "-h" : case "--help", "-h" :

View file

@ -700,7 +700,15 @@ func Main () () {
switch os.Args[1] { switch os.Args[1] {
case "version", "--version", "-v" : case "version", "--version", "-v" :
version.Main ("kawipiko-server") version.Main ("kawipiko-server", "version")
return
case "--sources-md5" :
version.Main ("kawipiko-server", "sources.md5")
return
case "--sources-cpio" :
version.Main ("kawipiko-server", "sources.cpio")
return return
case "--help", "-h" : case "--help", "-h" :

View file

@ -51,9 +51,27 @@ func Version (_executableName string, _executable string, _stream io.Writer) (er
func Main (_executableName string) () { func Main (_executableName string, _special string) () {
if _error := Version (_executableName, "<os.Executable>", os.Stdout); _error != nil {
AbortError (_error, "[74bfa815] unexpected error!") switch _special {
case "version" :
if _error := Version (_executableName, "<os.Executable>", os.Stdout); _error != nil {
AbortError (_error, "[74bfa815] unexpected error!")
}
case "sources.md5" :
if _, _error := os.Stdout.Write (StringToBytes (BuildSourcesMd5)); _error != nil {
AbortError (_error, "[c8f6b6c9] unexpected error!")
}
case "sources.cpio" :
if _, _error := os.Stdout.Write (BuildSourcesCpioGz); _error != nil {
AbortError (_error, "[292d8865] unexpected error!")
}
default :
panic ("[65a6f35f]")
} }
} }

View file

@ -23,13 +23,24 @@ func main () () {
switch _command { switch _command {
case "version", "--version", "-v" : case "version", "--version", "-v" :
version.Main ("kawipiko-wrapper") version.Main ("kawipiko-wrapper", "version")
return
case "--sources-md5" :
version.Main ("kawipiko-wrapper", "sources.md5")
return
case "--sources-cpio" :
version.Main ("kawipiko-wrapper", "sources.cpio")
return
case "server" : case "server" :
server.Main () server.Main ()
return
case "archiver" : case "archiver" :
archiver.Main () archiver.Main ()
return
default : default :
fmt.Fprintf (os.Stderr, "[!!] [44887671] unknown command: `%s`; aborting!\n", _command) fmt.Fprintf (os.Stderr, "[!!] [44887671] unknown command: `%s`; aborting!\n", _command)