View Single Post
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#19
@wicket,
I had a teensy-weensy problem with your script, it complained about the pipe symbol on the for line. Un-escaping bacwards apostrophes fixed it. Could it be a busybox vs. busybox-power issue?

While I was at it, I made another small modification, to allow the user to specify the target directory as a parameter. The default is still as per your post.

Here is my update, highlighting the changes. The bold green bits are added, bold blue are changed and the crossed out red ones are removed. The edited script is also attached as .txt, you will need to rename it to .sh and chmod +x it once downloaded.

Code:
cat << EOF > /home/user/getnokiadebs.sh && chmod +x /home/user/getnokiadebs.sh
#!/bin/sh

cache_path=/home/user/MyDocs/debs

if [ ".$1." == ".." ]; then
        echo "You did not specify the cache path."
        echo "The default path is '$cache_path'."
        read -p "Press [Enter] to continue or [Ctrl+C] to start again."
else
        cache_path=$1
fi

echo "Using '$cache_path' ..."

apt-get update

mkdir -p "$cache_path"/archives/partial

for pkg in \`dpkg -l | cut -f 3 -d ' '\`; do
        apt-cache policy $pkg | grep -q nokia.com && echo "Downloading $pkg" || continue
        apt-get --reinstall -y --force-yes -d -odir::cache="$cache_path" install $pkg
done
I am running it as we speak. About 40 MB downloaded and I am still at 'h' only. This may take a while

EDIT:
Just finished. It took about 3.5 hours and the overall size is nearly 2GB because of all the mobile-maps* packages. Without them it's only about 146 MB and a much shorter time. Mind you, your size is bound to vary a bit since my set is quite heavily modified.
.
Attached Files
File Type: txt getnokiadebs.txt (590 Bytes, 164 views)
__________________
Русский военный корабль, иди нахуй!

Last edited by pichlo; 2015-01-08 at 15:44. Reason: Added download time and size info
 

The Following 14 Users Say Thank You to pichlo For This Useful Post: