File tree Expand file tree Collapse file tree 1 file changed +48
-4
lines changed
Expand file tree Collapse file tree 1 file changed +48
-4
lines changed Original file line number Diff line number Diff line change 11#! /bin/sh
2+ PKGDIR=" /usr/local/aura"
3+ REPO_URL=" https://repo.auraos.org/index.json"
4+
5+ fetch_index () {
6+ curl -s $REPO_URL -o /tmp/aura-index.json
7+ }
8+
9+ search_pkg () {
10+ fetch_index
11+ jq -r ' .packages[] | "\(.name) \(.version)"' /tmp/aura-index.json
12+ }
13+
14+ download_pkg () {
15+ name=$1
16+ fetch_index
17+ url=$( jq -r " .packages[] | select(.name==\" $name \" ) | .url" /tmp/aura-index.json)
18+ if [ -z " $url " ]; then
19+ echo " [x] Package $name not found."
20+ exit 1
21+ fi
22+ echo " [+] Downloading $name ..."
23+ curl -L $url -o /tmp/$name .aura
24+ install_pkg /tmp/$name .aura
25+ }
26+
27+ install_pkg () {
28+ pkg=$1
29+ echo " [+] Installing $pkg "
30+ mkdir -p " $PKGDIR "
31+ tar -xzf " $pkg " -C " $PKGDIR "
32+ echo " [✓] Installed $( grep Name $PKGDIR /aura.meta | cut -d: -f2) "
33+ }
34+
35+ remove_pkg () {
36+ name=$1
37+ echo " [-] Removing $name "
38+ rm -rf " $PKGDIR /$name "
39+ }
40+
41+ list_pkg () {
42+ ls $PKGDIR
43+ }
44+
245case " $1 " in
3- install) echo " Installing $2 ..." ;;
4- remove) echo " Removing $2 ..." ;;
5- list) echo " Listing packages..." ;;
6- * ) echo " Usage: apm {install|remove|list}" ;;
46+ install) download_pkg $2 ;;
47+ remove) remove_pkg $2 ;;
48+ list) list_pkg ;;
49+ search) search_pkg ;;
50+ * ) echo " Usage: apm {install|remove|list|search}" ;;
751esac
You can’t perform that action at this time.
0 commit comments