Change bash to sh for cross compatibility and add brewinstall rule to Makefile

This commit is contained in:
Elara 2020-02-20 15:39:21 -08:00
parent c1917b0aac
commit 9a311a233a
2 changed files with 9 additions and 4 deletions

View File

@ -23,3 +23,8 @@ pacinstall: plugins/pacman/pak.cfg pak
aptitude: plugins/aptitude/pak.cfg pak aptitude: plugins/aptitude/pak.cfg pak
install -Dm644 plugins/aptitude/pak.cfg $(DESTDIR)/etc/pak.cfg install -Dm644 plugins/aptitude/pak.cfg $(DESTDIR)/etc/pak.cfg
install -Dm755 pak $(DESTDIR)/usr/bin/pak install -Dm755 pak $(DESTDIR)/usr/bin/pak
brewinstall: plugins/brew/pak.cfg pak
mount -uw /
install -m644 plugins/brew/pak.cfg $(DESTDIR)/etc/pak.cfg
install -m755 pak $(DESTDIR)/usr/bin/pak

8
pak.go
View File

@ -244,7 +244,7 @@ func main() {
if useRootBool { if useRootBool {
cmdArr := []string{rootCommand, packageManagerCommand, similarTo[0], strings.Join(args[1:], " ")} cmdArr := []string{rootCommand, packageManagerCommand, similarTo[0], strings.Join(args[1:], " ")}
cmdStr := strings.Join(cmdArr, " ") cmdStr := strings.Join(cmdArr, " ")
command := exec.Command("bash", "-c", cmdStr) command := exec.Command("sh", "-c", cmdStr)
command.Stdout = os.Stdout command.Stdout = os.Stdout
command.Stdin = os.Stdin command.Stdin = os.Stdin
command.Stderr = os.Stderr command.Stderr = os.Stderr
@ -256,7 +256,7 @@ func main() {
} else { } else {
cmdArr :=[]string{packageManagerCommand, similarTo[0], strings.Join(args[1:], " ")} cmdArr :=[]string{packageManagerCommand, similarTo[0], strings.Join(args[1:], " ")}
cmdStr := strings.Join(cmdArr, " ") cmdStr := strings.Join(cmdArr, " ")
command := exec.Command("bash", "-c", cmdStr) command := exec.Command("sh", "-c", cmdStr)
command.Stdout = os.Stdout command.Stdout = os.Stdout
command.Stdin = os.Stdin command.Stdin = os.Stdin
command.Stderr = os.Stderr command.Stderr = os.Stderr
@ -275,7 +275,7 @@ func main() {
if useRootBool { if useRootBool {
cmdArr :=[]string{rootCommand, packageManagerCommand, similarTo[0]} cmdArr :=[]string{rootCommand, packageManagerCommand, similarTo[0]}
cmdStr := strings.Join(cmdArr, " ") cmdStr := strings.Join(cmdArr, " ")
command := exec.Command("bash", "-c", cmdStr) command := exec.Command("sh", "-c", cmdStr)
command.Stdout = os.Stdout command.Stdout = os.Stdout
command.Stdin = os.Stdin command.Stdin = os.Stdin
command.Stderr = os.Stderr command.Stderr = os.Stderr
@ -287,7 +287,7 @@ func main() {
} else { } else {
cmdArr :=[]string{packageManagerCommand, similarTo[0]} cmdArr :=[]string{packageManagerCommand, similarTo[0]}
cmdStr := strings.Join(cmdArr, " ") cmdStr := strings.Join(cmdArr, " ")
command := exec.Command("bash", "-c", cmdStr) command := exec.Command("sh", "-c", cmdStr)
command.Stdout = os.Stdout command.Stdout = os.Stdout
command.Stdin = os.Stdin command.Stdin = os.Stdin
command.Stderr = os.Stderr command.Stderr = os.Stderr