-
Notifications
You must be signed in to change notification settings - Fork 0
/
imur
91 lines (87 loc) · 2.92 KB
/
imur
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/dash
aursearch () {
curl -s "https://aur.archlinux.org/rpc/?v=5&type=search&arg=$1" | jq -r '.results [] | "-------------------------------------\n"+.Name+"\n"+.Description'
echo "-------------------------------------"
}
aurmanage () {
if [ "$1" = "update" ]; then
for i in $(pacman -Qm | cut -d' ' -f1); do
iv=$(pacman -Q $i | cut -d' ' -f2)
cv=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$i" | jq -r '.results[] | .Version')
if [ ! -z "$cv" ]; then
if [ "$iv" = "$cv" ]; then
echo -n "$i "
aniup
else
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $i ] && rm -rf ./$i >> /dev/null 2>&1
[ -f $i.tar.gz ] && rm -f ./$i.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$i.tar.gz
tar -xzf ./$i.tar.gz
cd ./$i
makepkg -isc
cd ~
fi
else
echo "! $i is not found at aur.archlinux.org"
fi
done
else
chap=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$2" | jq -r '.results [] | .Version')
if [ ! -z "$chap" ]; then
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d "$2" ] && rm -rf ./"$2" >> /dev/null 2>&1
[ -f "$2.tar.gz" ] && rm -f ./"$2.tar.gz" >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/"$2.tar.gz"
tar -xzf ./"$2.tar.gz"
case $1 in
install)
cd ./"$2"
makepkg -isc
cd ~
;;
download)
echo "----------> AUR Package has been downloaded and extracted."
echo " "
;;
esac
else
echo "! The package does not exist in AUR."
fi
fi
}
aniup () {
ch='-:-:-:-:-:-:-:-:-:-:-:>: :u:p: :t:o: :d:a:t:e: :'
IFS=:
for i in $ch; do
echo -n $i
sleep 0.08
done
echo ""
}
case $1 in
search)
aursearch $2
;;
install)
aurmanage install $2
;;
download)
aurmanage download $2
;;
update)
aurmanage update
;;
*)
echo "------------------------------------------------------------"
echo " Do one of search, install, download and update after imur"
echo " Examples:"
echo " ~ $ imur search <keyword>"
echo " ~ $ imur install <packagename>"
echo " ~ $ imur download <packagename>"
echo " ~ $ imur update"
echo "------------------------------------------------------------"
;;
esac