mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Dont rm directories with -G unless using -f
This commit is contained in:
parent
070f103fb9
commit
004595a396
2 changed files with 34 additions and 5 deletions
37
download.go
37
download.go
|
@ -158,9 +158,29 @@ func getPkgbuilds(pkgs []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(aur) > 0 {
|
if len(aur) > 0 {
|
||||||
bases := getBases(info)
|
allBases := getBases(info)
|
||||||
toSkip := pkgbuildsToSkip(bases, nil)
|
bases := make([]Base, 0)
|
||||||
if _, err = downloadPkgbuilds(bases, toSkip, wd); err != nil {
|
|
||||||
|
for _, base := range allBases {
|
||||||
|
name := base.Pkgbase()
|
||||||
|
_, err = os.Stat(filepath.Join(wd, name))
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
fmt.Println(bold(red(smallArrow)), err)
|
||||||
|
continue
|
||||||
|
} else if os.IsNotExist(err) || cmdArgs.existsArg("f", "force") || shouldUseGit(filepath.Join(wd, name)) {
|
||||||
|
if err = os.RemoveAll(filepath.Join(wd, name)); err != nil {
|
||||||
|
fmt.Println(bold(red(smallArrow)), err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("%s %s %s\n", yellow(smallArrow), cyan(name), "already downloaded -- use -f to overwrite")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
bases = append(bases, base)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = downloadPkgbuilds(bases, nil, wd); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,9 +247,18 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = os.RemoveAll(filepath.Join(path, name)); err != nil {
|
_, err = os.Stat(filepath.Join(path, name))
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
fmt.Println(bold(red(smallArrow)), err)
|
fmt.Println(bold(red(smallArrow)), err)
|
||||||
continue
|
continue
|
||||||
|
} else if os.IsNotExist(err) || cmdArgs.existsArg("f", "force") {
|
||||||
|
if err = os.RemoveAll(filepath.Join(path, name)); err != nil {
|
||||||
|
fmt.Println(bold(red(smallArrow)), err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("%s %s %s\n", yellow(smallArrow), cyan(name), "already downloaded -- use -f to overwrite")
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
names[name] = url
|
names[name] = url
|
||||||
|
|
|
@ -389,7 +389,7 @@ func isArg(arg string) bool {
|
||||||
case "ignoregroup":
|
case "ignoregroup":
|
||||||
case "needed":
|
case "needed":
|
||||||
case "overwrite":
|
case "overwrite":
|
||||||
case "force":
|
case "f", "force":
|
||||||
case "c", "changelog":
|
case "c", "changelog":
|
||||||
case "deps":
|
case "deps":
|
||||||
case "e", "explicit":
|
case "e", "explicit":
|
||||||
|
|
Loading…
Reference in a new issue