-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaptAdvance
More file actions
executable file
·43 lines (36 loc) · 1011 Bytes
/
aptAdvance
File metadata and controls
executable file
·43 lines (36 loc) · 1011 Bytes
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
#!/bin/sh
#if echo "$1" | grep -q "[upgrade]" || echo "$2" | grep -q "[install]" || echo "$2" | grep -q "dist-upgrade"; then
#aptitude update;
echo "Advance APT multi-process cache download accelerating script."
echo "Processing ... ";
rm /tmp/download.list;
for i in $@; do
echo "Extract package list of $i"
cd /var/cache/apt/archives/;
apt-get -y -f --print-uris install $i > /tmp/debs.list
egrep -o -e "(ht|f)tp://[^\']+" /tmp/debs.list >> /tmp/download.list;
done
echo "Downloading ... "
while read line ; do
downloadPN=$(ps -A | grep -c download)
while [ $downloadPN -ge 5 ]; do
sleep 1;
downloadPN=$(ps -A | grep -c download)
done
download $line &
# sleep 1;
done < /tmp/download.list
#sleep 1;
axelPN=$(ps -A | grep -c aria2c)
while [ $axelPN -ge 1 ]; do
sleep 1;
axelPN=$(ps -A | grep -c aria2c)
done
#sleep 1;
aptPN=$(ps -A | grep -c apt-get)
while [ $aptPN -ge 1 ]; do
sleep 1;
aptPN=$(ps -A | grep -c apt-get)
done
echo "Running apt-get ..."
apt-get -y -f install $@