@@ -23,16 +23,14 @@ import (
2323
2424func main () {
2525 var (
26- prefix = "gitea-licenses"
27- url = "https://api.github.com/repos/spdx/license-list-data/tarball"
28- githubApiToken = ""
29- githubUsername = ""
30- destination = ""
31- licenseAliasesDestination = ""
26+ prefix = "gitea-licenses"
27+ url = "https://api.github.com/repos/spdx/license-list-data/tarball"
28+ githubApiToken = ""
29+ githubUsername = ""
30+ destination = ""
3231 )
3332
3433 flag .StringVar (& destination , "dest" , "options/license/" , "destination for the licenses" )
35- flag .StringVar (& licenseAliasesDestination , "aliasesdest" , "options/license-aliases.json" , "destination for same license json" )
3634 flag .StringVar (& githubUsername , "username" , "" , "github username" )
3735 flag .StringVar (& githubApiToken , "token" , "" , "github api token" )
3836 flag .Parse ()
@@ -150,11 +148,19 @@ func main() {
150148 log .Fatalf ("Failed to create json bytes. %s" , err )
151149 return
152150 }
151+
152+ licenseAliasesDestination := path .Join (destination , "etc" , "license-aliases.json" )
153+ if err := os .MkdirAll (filepath .Dir (licenseAliasesDestination ), 0o755 ); err != nil {
154+ log .Fatalf ("Failed to create directory for license aliases json file. %s" , err )
155+ return
156+ }
157+
153158 f , err := os .Create (licenseAliasesDestination )
154159 if err != nil {
155160 log .Fatalf ("Failed to create license aliases json file. %s" , err )
156161 }
157162 defer f .Close ()
163+
158164 if _ , err = f .Write (b ); err != nil {
159165 log .Fatalf ("Failed to write license aliases json file. %s" , err )
160166 }
0 commit comments