Notices


Reply
Thread Tools
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#11
Hmmmm, now I am confused.
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?
 
Posts: 540 | Thanked: 387 times | Joined on May 2009
#12
Sorry for confusing you.

The initial commands were diagnostic to see if the apt-get system had any errors it needed to correct (these don't show up in Hildon Application Manager rather it just stops working)

Now that you have reflashed and there are no problems you can ignore that step.

As far as what you asked - saving your .deb packages for re-installation later. You should be able to use the graphical Application Manager as normal.

(If someone wants to package this up as a pretty GUI program, then go for it. I'm not a fan of the syntax related to packaging up GUI programs)

Backup
Make folder/directory to on SD card
Code:
# mkdir /media/mmc1/debz
Copy all installed packages to SD card:
Code:
# cp /var/cache/apt/archives/*.deb /media/mmc1/debz/
Re-install packages at later date
Make folder/directory in Maemo
Code:
# mkdir /root/debz/
Copy packages from SD card to Maemo
Code:
# cp /media/mmc1/debz/*.deb /root/debz/
Install locally saved packages
Code:
# debzinstall() { cd /root/debz; foo=`ls *.deb`; dpkg -i $foo; }
# debzinstall

Last edited by linuxeventually; 2010-07-29 at 08:12.
 

The Following User Says Thank You to linuxeventually For This Useful Post:
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#13
Ok, so I wasn't off the mark with intent, just not fully understanding all the code.
The funny thing is, I did it yesterday and reinstalled 48 apps to be exact and when I went to the folder: /var/cache/apt/archive/
Only 2 deb files resided and they were nano and some other file which I think was associated to nano. So this doesn't seem to be the place it stores the archives?
Any other suggestions guys, I'm sorry I haven't a clue and you are doing your best though haven't an n900.
I hope I don't sound rude linuxeventually, I am very grateful, you are assisting me perfectly.

Stephen
 
Posts: 540 | Thanked: 387 times | Joined on May 2009
#14
My browser ate this post, so let's try again...

/var/cache/apt/archive is not meant as a permanent storage for .deb packages (unfortunately). Every once in awhile a package manager will do some "housecleaning" and delete the contents of that folder. It's really only meant as a temporary storage location while the package manager installs the packages.

While it would be trivial to whip up something to copy the .deb files to your SD card always immediately after installing packages from apt-get (or even something like grabdebz() { sudo apt-get -d install $1; cp -n /var/apt/cache/archives/*.deb /media/mmc1/debz/; sudo apt-get install $1; }; grabdebz ) That would only work if your only means of installing packages was through apt-get.

But because you use Hildon Application Manager (GUI) and I am not aware of anyway to tell it NOT to delete the contents of /var/cache/apt/archives and furthermore can't inject an option to tell it to first download, then copy to SD, then install packages, I think you are out of luck with that method. And it's not open source, so the option cannot be added. You might be able to convince hqh to include the functionality in Fapman though.

So then my only suggestion would be to simply save a list of installed packages and store that list somewhere safe (SD card for instance). Then whenever you end up needing to re-flash, go somewhere that has free wifi and use that list to re-download and install those packages onto your new install. It's not ideal but I don't know what else to suggest.

Backup:
Code:
foo=`dpkg -l | grep ii | awk '{ print $2 }'`; echo $foo > /media/mmc1/copymesomewheresafe
Explanation of code: List install packages via dpkg, then cut off the top row of output, then delete all but the second column and throw all of that in a variable called "foo". Then output the variable foo to a file on your SD card.

Restore:
Code:
bar=`cat /media/mmc1/copymesomewheresafe`; apt-get install $bar
Explanation of code: Output the contents of that saved file listing all your packages that you have saved on your SD card and throw that in a variable called "bar". Then tell apt-get to install everything in the variable bar.

Something else that would be nice but that AFAIK doesn't exist and would be a major pain to script would be to figure out how to tell [say for example] your Ubuntu desktop/laptop to download the Fremantle armel packages from your list (including all dependencies) to a SD card to install that way.
 

The Following User Says Thank You to linuxeventually For This Useful Post:
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#15
ok,
so just downloaded all apps again and did apt-get upgrade/ update, install nano, wget, bzip2 & unzip. These are the only deb files listed in the archives cache. This time I downloaded 44 apps via app manager, not one of these are listed in the archives folder and hence none copied across. It is mainly the apps manager debs I am trying to grab. I assume these are either erased immediately or downloaded to another folder?
 
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#16
Linuxeventually,
sorry replied and then saw your comments. Understood mate, the later is thinking outside the square and liking that. Please post any suggestions, happy to try and feed back.
Thanks for your help so far.

Stephen
 
Posts: 540 | Thanked: 387 times | Joined on May 2009
#17
A thought occurs to me.

This is an initially inefficient idea but in the long-run if you reflash often would a.) work b.) in the long run be efficient.

Okay so rather than copy the contents of the temporary store folder and rather than download packages before installing them, why not install packages like normal, then occasionally when you want to back them up, re-download them to your SD card.

1.) Install packages like normal

2.) Prep
Code:
# mkdir /media/mmc1/debz{,/archives}
# cp -r /var/cache/apt/archives/partial/ /media/mmc1/debz/archives/
3.) Re-download all packages to SD
Code:
# 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
4.) Install packages to newly flashed N900
Code:
# debzinstall() { alldebz=`cat /media/mmc1/installdebz.txt`; apt-get -o dir::cache=/media/mmc1/debz install $alldebz; }
# debzinstall
I'll see if I can't work out a way to tell it to not download packages you already have saved to the SD card...
 
Posts: 540 | Thanked: 387 times | Joined on May 2009
#18
@Coffee

Okay I put together a script that should work for you.
It's fairly "smart" so it shouldn't give you any problems.

The script is attached.
I also put it in my box.net account:
http://www.box.net/shared/z8crpmsrtd
(save to /usr/bin/savedebz and chmod +x /usr/bin/savedebz )

The same script follows:
Code:
#!/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."
USAGE:

Backup/Download files to SD
Code:
$ sudo savedebz
Restore/Install to N900/N8X0
Code:
$ sudo savedebz install
You will be prompted with a question to ask if you are sure, type y and press enter. Then apt-get will ask you if you are sure, type y and press enter. It may ask an additional question (install without verification) again y and press enter.
Attached Files
File Type: txt savedebz.txt (2.4 KB, 82 views)

Last edited by linuxeventually; 2010-07-30 at 06:06.
 

The Following User Says Thank You to linuxeventually For This Useful Post:
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#19
Thanks mate, will download and give a try now.
 
Posts: 222 | Thanked: 22 times | Joined on Jul 2010 @ Sydney Australia
#20
linuxeventually,
I have tried and failed, I think my fault. I have since partitioned my MicroSD card into 4, as follows:
mmcblk1p1 MicroSD 3gb fat32
mmcblk1p2 Swap 500mb 82
mmcblkp3 NITDroid 1.9gb ext3
mmcblkp4 Easy Debian 2.4gb ext2

It errors" mkdir: cannot create directory '/ media/mmc1/debz {,
/archives}
Does this need to be altered slightly to write specifically mmcblk1p1?
Sorry for the hassle, much appreciated though, this will be so good and so close.....
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:10.