|
|
2010-07-29
, 07:41
|
|
Posts: 540 |
Thanked: 387 times |
Joined on May 2009
|
#12
|
# mkdir /media/mmc1/debz
# cp /var/cache/apt/archives/*.deb /media/mmc1/debz/
# mkdir /root/debz/
# cp /media/mmc1/debz/*.deb /root/debz/
# debzinstall() { cd /root/debz; foo=`ls *.deb`; dpkg -i $foo; }
# debzinstall
| The Following User Says Thank You to linuxeventually For This Useful Post: | ||
|
|
2010-07-29
, 21:42
|
|
Posts: 222 |
Thanked: 22 times |
Joined on Jul 2010
@ Sydney Australia
|
#13
|
|
|
2010-07-29
, 22:42
|
|
Posts: 540 |
Thanked: 387 times |
Joined on May 2009
|
#14
|
foo=`dpkg -l | grep ii | awk '{ print $2 }'`; echo $foo > /media/mmc1/copymesomewheresafe
bar=`cat /media/mmc1/copymesomewheresafe`; apt-get install $bar
| The Following User Says Thank You to linuxeventually For This Useful Post: | ||
|
|
2010-07-29
, 22:43
|
|
Posts: 222 |
Thanked: 22 times |
Joined on Jul 2010
@ Sydney Australia
|
#15
|
|
|
2010-07-29
, 22:53
|
|
Posts: 222 |
Thanked: 22 times |
Joined on Jul 2010
@ Sydney Australia
|
#16
|
|
|
2010-07-29
, 23:36
|
|
Posts: 540 |
Thanked: 387 times |
Joined on May 2009
|
#17
|
# mkdir /media/mmc1/debz{,/archives}
# cp -r /var/cache/apt/archives/partial/ /media/mmc1/debz/archives/
# foobar=`dpkg -l | grep ii | awk '{ print $2 }'`; echo $foobar > /media/mmc1/installdebz.txt; apt-get -o dir::cache=/media/mmc1/debz --reinstall -d install $foobar
# debzinstall() { alldebz=`cat /media/mmc1/installdebz.txt`; apt-get -o dir::cache=/media/mmc1/debz install $alldebz; }
# debzinstall
|
|
2010-07-30
, 05:58
|
|
Posts: 540 |
Thanked: 387 times |
Joined on May 2009
|
#18
|
#!/bin/bash
##########################################
# savedebz by Linux Eventually ver 0.5 ###
##########################################
# SD card install location
sdhc="/media/mmc1"
# Install packages back to Nokia Internet Tablet
if [ "$1" = "install" ];
then echo "Install packages from SD card to NXx0?";
read -p "Are you sure? (y/n): " confirminstall
fi
if [ "$confirminstall" = "y" ]; then
echo "Installing ... (this will take awhile)"
debzinstall() { alldebz=`cat $sdhc/installdebz`; apt-get -o dir::cache=$sdhc/debz install $alldebz; }
debzinstall
echo "debz installation complete"
exit 0
else if [ "$confirminstall" = "n" ]; then
echo "Installation not selected. Exiting."; exit 0
else if [ ! -z "$confirminstall" ]; then echo "Invalid selection"; exit 0
fi
fi
fi
# If invalid parameter then quit
if [ ! -z "$1" ];
then echo "ERROR Invalid parameter"
echo "Valid options are none or install"
exit 0
fi
# Ask user to execute script
if [ -z "$1" ]; then
echo "Download packages to SD card?";
read -p "Are you sure? (y/n): " confirmbackup
if [ "$confirmbackup" = "y" ]; then
echo "Installing ... (this will take awhile)"
else if [ "$confirmbackup" = "n" ]; then
echo "Download not selected. Exiting."; exit 0
else echo "Invalid selection"; exit 0
fi
fi
fi
# Create directory on SD card
if [ ! -d "$sdhc/debz/archives" ];
then
mkdir $sdhc/debz{,/archives}
cp -r /var/cache/apt/archives/partial/ $sdhc/debz/archives/
fi
# Save list of installed packages
dpkg -l | grep ii | awk '{ print $2 }' > $sdhc/alldebz;
# Save list of packages on SD
ls $sdhc/debz/archives/ | awk 'BEGIN{FS="_"};{print$1}' > $sdhc/debzsd;
# Compare files (to save bandwidth)
cd $sdhc
###########
## pdiff ##
###########
perl <<'EOF'
$output = newdebz;
chomp($output);
open a, "<alldebz";
open b, "<debzsd";
local $/;
my @a = split /\n/, <a>;
my @b = split /\n/, <b>;
my %b = map { $_ => 1 } @b; # Make hash of B
my @res = grep { !defined $b{$_} } @a; # Everything in A not in B
open myoutput, ">$output";
select myoutput;
print join "\n", @res;
print "\n";
EOF
###########
# Convert line breaks to spaces
foobar=`cat $sdhc/newdebz`; echo $foobar > $sdhc/installdebz
pkgz=`cat $sdhc/installdebz`
# Re-download packages and save them to SD card
apt-get -o dir::cache=$sdhc/debz --reinstall -d install $pkgz
echo "Finished."
$ sudo savedebz
$ sudo savedebz install
| The Following User Says Thank You to linuxeventually For This Useful Post: | ||
|
|
2010-08-02
, 01:43
|
|
Posts: 222 |
Thanked: 22 times |
Joined on Jul 2010
@ Sydney Australia
|
#19
|
|
|
2010-08-02
, 01:58
|
|
Posts: 222 |
Thanked: 22 times |
Joined on Jul 2010
@ Sydney Australia
|
#20
|
I thought he was saying the apps manager downloads the apps to the /var/cache/apt/archives/ folder and then extracts from there. If apt-get clean was not used then the .deb files will remain and hence we are copying them from the /var/cache/apt/archives/ to the debz folder in SD card /media/mmc1/debz/.
I wasn't sure what the next line did though sounded as if it made sure you got all the files, thought foo was a command or something.
So your comments now really confuse me as to what is actually happening and what I am meant to do. Do I still download via app manager as normal and is this to be run in term afterward?