Skip to content

Commit ed7c1b6

Browse files
committed
v0.27 Fixes
1 parent 2d72e67 commit ed7c1b6

19 files changed

Lines changed: 121 additions & 79 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ If this repo was useful to you, feel free to buy us some coffee! :)
179179

180180
### VERSIONS
181181

182+
#### v0.27
183+
184+
- Fixed restore repositories
185+
- Fixed restore go packages
186+
- Fixed restore cargo packages
187+
188+
182189
#### v0.26
183190

184191
- Arch, AUR, & Enable/Disable Native Package Managers [#24](https://github.com/hkdb/app/issues/24)

arch/paru_repo.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ import (
1010
"os/exec"
1111
)
1212

13-
func ParuAddRepo(s, g string) {
13+
func ParuAddRepo(s, g string, restore bool) {
1414

1515
repo := s
1616
if sExt := utils.GetFileExtension(s); sExt == "sh" {
1717
repo = utils.GetFileName(s)
1818
} else {
1919
utils.PrintErrorMsgExit("Input Error:", "Arch based distros will only take bash scripts as the add-repo arg...")
2020
}
21-
exists, err := db.RepoExists("paru", repo)
22-
if err != nil {
23-
utils.PrintErrorExit("Error:", err)
24-
}
25-
if exists == true {
26-
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
21+
22+
if restore == true {
23+
exists, err := db.RepoExists("paru", repo)
24+
if err != nil {
25+
utils.PrintErrorExit("Error:", err)
26+
}
27+
if exists == true {
28+
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
29+
}
2730
}
2831

2932
if ws := utils.HasWhiteSpace(s); ws == true {

arch/repo.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ import (
1010
"os/exec"
1111
)
1212

13-
func AddRepo(s, g string) {
13+
func AddRepo(s, g string, restore bool) {
1414

1515
repo := s
1616
if sExt := utils.GetFileExtension(s); sExt == "sh" {
1717
repo = utils.GetFileName(s)
1818
} else {
1919
utils.PrintErrorMsgExit("Input Error:", "Arch based distros will only take bash scripts as the add-repo arg...")
2020
}
21-
exists, err := db.RepoExists("pacman", repo)
22-
if err != nil {
23-
utils.PrintErrorExit("Error:", err)
24-
}
25-
if exists == true {
26-
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
21+
22+
if restore == true {
23+
exists, err := db.RepoExists("pacman", repo)
24+
if err != nil {
25+
utils.PrintErrorExit("Error:", err)
26+
}
27+
if exists == true {
28+
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
29+
}
2730
}
2831

2932
if ws := utils.HasWhiteSpace(s); ws == true {

arch/yay_repo.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ import (
1010
"os/exec"
1111
)
1212

13-
func YayAddRepo(s, g string) {
13+
func YayAddRepo(s, g string, restore bool) {
1414

1515
repo := s
1616
if sExt := utils.GetFileExtension(s); sExt == "sh" {
1717
repo = utils.GetFileName(s)
1818
} else {
1919
utils.PrintErrorMsgExit("Input Error:", "Arch based distros will only take bash scripts as the add-repo arg...")
2020
}
21-
exists, err := db.RepoExists("yay", repo)
22-
if err != nil {
23-
utils.PrintErrorExit("Error:", err)
24-
}
25-
if exists == true {
26-
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
21+
22+
if restore == true {
23+
exists, err := db.RepoExists("yay", repo)
24+
if err != nil {
25+
utils.PrintErrorExit("Error:", err)
26+
}
27+
if exists == true {
28+
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
29+
}
2730
}
2831

2932
if ws := utils.HasWhiteSpace(s); ws == true {

cargo/cargo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@ func InstallAll() {
158158
utils.PrintErrorExit("Cargo - Read Repo ERROR:", err)
159159
}
160160
if git == true {
161+
fmt.Println("GIT Package:", p)
161162
url, tag, err := db.GetGitSetup(mgr, p)
162163
if err != nil {
163164
utils.PrintErrorExit("Cargo - Get Repo Data ERROR:", err)
164165
}
165166
install := exec.Command(env.Env, env.Bash, "-c", mgr+" install --git "+url+" --tag "+tag)
166167
utils.RunCmd(install, "Installation Error:")
167168
} else {
169+
fmt.Println("REG Package:", p)
168170
install := exec.Command(mgr, "install", p)
169171
utils.RunCmd(install, "Installation Error:")
170172
}

db/cargo_git.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func GitExists(pm, r string) (bool, error) {
1313

14-
aRepos := strings.Split(r, " ")
14+
aRepos := strings.Fields(r)
1515
repos, err := ReadPkgSlice("packages", "repo", pm)
1616
if err != nil {
1717
return false, err
@@ -20,7 +20,12 @@ func GitExists(pm, r string) (bool, error) {
2020
for i := 0; i < len(aRepos); i++ {
2121
installed := slices.Contains(repos, aRepos[i])
2222
if installed == true {
23-
return true, nil
23+
if len(aRepos[i]) < 4 {
24+
return false, nil
25+
}
26+
if aRepos[i][:4] == "http" {
27+
return true, nil
28+
}
2429
}
2530
}
2631

db/packages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func ReadPkgSlice(root, col, pm string) ([]string, error) {
210210
return []string{""}, err
211211
}
212212

213-
pkgSlice := strings.Split(pkgs, " ")
213+
pkgSlice := strings.Fields(pkgs)
214214

215215
return pkgSlice, nil
216216

debian/repo.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ import (
1111
"strings"
1212
)
1313

14-
func AddRepo(s, g string) {
14+
func AddRepo(s, g string, restore bool) {
1515

1616
pkg := s
1717
if sExt := utils.GetFileExtension(s); sExt == "sh" {
1818
pkg = utils.GetFileName(s)
1919
}
20-
exists, err := db.RepoExists("apt", pkg)
21-
if err != nil {
22-
utils.PrintErrorExit("Error:", err)
23-
}
24-
if exists == true {
25-
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
20+
21+
if restore == false {
22+
exists, err := db.RepoExists("apt", pkg)
23+
if err != nil {
24+
utils.PrintErrorExit("Error:", err)
25+
}
26+
if exists == true {
27+
utils.PrintErrorMsgExit("Error:", "This repo has already been added to app before...")
28+
}
2629
}
2730

2831
if ws := utils.HasWhiteSpace(s); ws == true {
@@ -68,8 +71,10 @@ func AddRepo(s, g string) {
6871

6972
fmt.Println("\n" + name + " has been added...\n")
7073
// Record added repo
71-
if err := db.RecordRepo("apt", name); err != nil {
72-
utils.PrintErrorExit("Repo Record Error:", err)
74+
if restore == true {
75+
if err := db.RecordRepo("apt", name); err != nil {
76+
utils.PrintErrorExit("Repo Record Error:", err)
77+
}
7378
}
7479

7580
}

dist/getapp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# app installer #
55
#################
66

7-
VER="v0.26"
7+
VER="v0.27"
88
CYAN='\033[0;36m'
99
GREEN='\033[1;32m'
1010
NC='\033[0m'

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<a target="_blank" href="https://github.com/hkdb/app"><img class="logo" src="github.png"></a>
8484
</div>
8585
<div>
86-
<p class="version">Latest: v0.26 (ALPHA)</p>
86+
<p class="version">Latest: v0.27 (ALPHA)</p>
8787
</div>
8888
<script>
8989
// Get the <pre> element

0 commit comments

Comments
 (0)