Back up your applications
(added Archive section. renamed titles to be more descriptive) |
(Undo revision 45777 by 70.135.114.247 (Talk) SPAM) |
||
(18 intermediate revisions not shown) | |||
Line 11: | Line 11: | ||
To follow this tutorial, you need root access on your device and the following tools: | To follow this tutorial, you need root access on your device and the following tools: | ||
*Terminal emulator (X Terminal or SSH) | *Terminal emulator (X Terminal or SSH) | ||
- | *VIM editor (Available in Extras) | + | *VIM editor (Available in [[Extras]]) |
== Create the Archive folder == | == Create the Archive folder == | ||
* Open a terminal emulator and create the required folders using the following command: | * Open a terminal emulator and create the required folders using the following command: | ||
<pre> | <pre> | ||
- | mkdir /home/user/MyDocs/apt-archive-cache | + | $ mkdir /home/user/MyDocs/apt-archive-cache |
- | mkdir /home/user/MyDocs/apt-archive-cache/archives | + | $ mkdir /home/user/MyDocs/apt-archive-cache/archives |
- | mkdir /home/user/MyDocs/apt-archive-cache/archives/partial | + | $ mkdir /home/user/MyDocs/apt-archive-cache/archives/partial |
</pre> | </pre> | ||
- | If you wish to use a different folder, | + | or the equivalent |
+ | <pre> | ||
+ | $ mkdir -p /home/user/MyDocs/apt-archive-cache/archives/partial | ||
+ | </pre> | ||
+ | If you wish to use a different folder, substitute /home/user/MyDocs with the desired path. | ||
== Create Package-List == | == Create Package-List == | ||
*As a normal user type the following command to create a file (package.list) that contains a list of all the packages installed on the device: | *As a normal user type the following command to create a file (package.list) that contains a list of all the packages installed on the device: | ||
- | + | <pre>$ dpkg --get-selections|grep install|grep -v deinstall>/home/user/package.list | |
</pre> | </pre> | ||
- | + | In case you just want to download a selection of packages from that list, you should edit it and remove the lines you do not need. | |
- | + | For example, if you just want to download a copy of the package ''abiword'', then you should: | |
- | + | ||
- | + | ||
*As a normal user type the following command: | *As a normal user type the following command: | ||
- | <pre>$ cat /home/user/package.list|grep abiword>package-abiword.list</pre> | + | <pre>$ cat /home/user/package.list|grep abiword>/home/user/package-abiword.list</pre> |
- | + | If you want to download all packages, except one of them: ''debconf'', for example. Then you should: | |
*As a normal user type the following command: | *As a normal user type the following command: | ||
- | <pre>$ cat /home/user/package.list|grep -v debconf>package-without-debconf.list</pre> | + | <pre>$ cat /home/user/package.list|grep -v debconf>/home/user/package-without-debconf.list</pre> |
- | == | + | == Edit Package-List == |
After previous steps, you have a list with all the desired packages you want to download to your device. In our previous examples this list could be any one of these: | After previous steps, you have a list with all the desired packages you want to download to your device. In our previous examples this list could be any one of these: | ||
Line 49: | Line 51: | ||
Now you just need to edit this list in order to use it with ''apt-get'': | Now you just need to edit this list in order to use it with ''apt-get'': | ||
*As a normal user type the following command: | *As a normal user type the following command: | ||
- | <pre>$ | + | <pre>$ vim /home/user/package.list </pre> |
*After ''vi'' editor is running, then type the following command: | *After ''vi'' editor is running, then type the following command: | ||
<pre> :%s!install!! </pre> | <pre> :%s!install!! </pre> | ||
*This last command will clean the lines, removing the word ''install'' and leaving just the name of the packages. Now we want to add an order for ''apt-get'' to download the desired packages, so type the following command: | *This last command will clean the lines, removing the word ''install'' and leaving just the name of the packages. Now we want to add an order for ''apt-get'' to download the desired packages, so type the following command: | ||
- | <pre> :%s!^!apt-get --force-yes -yy -d install --reinstall ! </pre> | + | <pre> :%s!^!apt-get --force-yes -yy -d install --reinstall -o dir::cache=/home/user/MyDocs/apt-archive-cache ! </pre> |
*This last command will add to the beginning of each line the needed instructions for ''apt-get'' to only download the packages: ''-d install --reinstall''. In order to prevent the script from stopping at any question we have inserted the ''--force-yes -yy'' option. Now we just need to save the file typing the following command: | *This last command will add to the beginning of each line the needed instructions for ''apt-get'' to only download the packages: ''-d install --reinstall''. In order to prevent the script from stopping at any question we have inserted the ''--force-yes -yy'' option. Now we just need to save the file typing the following command: | ||
<pre> ZZ </pre> | <pre> ZZ </pre> | ||
+ | == Download Packages == | ||
+ | Executing the package-list script will download the packages. | ||
*To execute the script we need first to get ROOT access. | *To execute the script we need first to get ROOT access. | ||
*Then as ROOT type the following command: | *Then as ROOT type the following command: | ||
<pre> # sh</home/user/package.list </pre> | <pre> # sh</home/user/package.list </pre> | ||
- | + | You should now see the downloads in progress. | |
- | <pre>$ ls / | + | <pre> |
+ | Reading package lists... Done | ||
+ | Building dependency tree | ||
+ | Reading state information... Done | ||
+ | 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. | ||
+ | Need to get 213kB of archives. | ||
+ | After this operation, 0B of additional disk space will be used. | ||
+ | Get:1 http://repository.maemo.org fremantle/free 100boxes 0.5.0-4 [213kB] | ||
+ | Fetched 213kB in 0s (538kB/s) | ||
+ | Download complete and in download only mode | ||
+ | </pre> | ||
+ | Depending on the size of the list, this could take a long time. After it is completed, the downloaded packages can be listed with the following command: | ||
+ | <pre>$ ls /home/user/MyDocs/apt-archive-cache/archives|grep deb | ||
+ | |||
+ | Nokia-N900-42-11:/home/user# ls /home/user/MyDocs/apt-archive-cache/archives|grep deb | ||
+ | 100boxes_0.5.0-4_armel.deb | ||
+ | accdisplay_1.0_armel.deb | ||
+ | adblock-plus-1.0_1maemo0-8_all.deb | ||
+ | ati85_1.4.1-1_armel.deb | ||
+ | battlegweled_0.9-4_armel.deb | ||
+ | bluetooth-dun_1.0-2_armel.deb | ||
+ | </pre> | ||
+ | |||
+ | == Install Package-List == | ||
+ | With previous steps you have downloaded all your favourite applications, for backup purposes. Now just imagine that you need to install them again from scratch, then you will need to proceed as follows: | ||
+ | |||
+ | To install all the packages from the list: | ||
+ | * open the package.list file in VIM | ||
+ | * remove the -d option from each of the lines (:%s!-d!!) | ||
+ | * save and execute the file again as root (# sh</home/user/package.list) | ||
+ | |||
+ | If you wish to install an individual package, execute the apt-get command separately for that package by using the specific line from the packages.list file. | ||
+ | <pre> | ||
+ | Nokia-N900-42-11:/home/user# apt-get --force-yes -yy install --reinstall -o dir::cache=/home/user/MyDocs/apt-archive-cache 100boxes | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree | ||
+ | Reading state information... Done | ||
+ | 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. | ||
+ | Need to get 0B/213kB of archives. | ||
+ | After this operation, 0B of additional disk space will be used. | ||
+ | (Reading database ... 36360 files and directories currently installed.) | ||
+ | Preparing to replace 100boxes 0.5.0-4 (using .../100boxes_0.5.0-4_armel.deb) ... | ||
+ | Unpacking replacement 100boxes ... | ||
+ | Setting up 100boxes (0.5.0-4) ... | ||
+ | </pre> | ||
+ | |||
+ | == Dependencies == | ||
+ | * executing package.list will only download the package, not the dependencies. This may create problems during restore when the package dependencies are not available in the archive. Of course, this would only be a problem if the package list was a selection of the entire system package list. When downloading the entire system package list, all packages would be available and dependecies would not be an issue. | ||
+ | * safe way would be to remove the application via 'apt-get remove' and 'apt-get autoremove' and then use the apt-get with the -d and -o option to download the package with the dependencies. | ||
== Further Questions == | == Further Questions == | ||
If you have further questions, do not hesitate to place the question here in this section, and it will be answered in short. | If you have further questions, do not hesitate to place the question here in this section, and it will be answered in short. | ||
+ | |||
+ | You may also ask for help sending me an [mailto:n900@academia-online.org e-mail] | ||
+ | |||
+ | [[Category:Power users]] | ||
+ | [[Category:HowTo]] |
Latest revision as of 02:51, 22 November 2011
Contents |
[edit] Scenario
Let us suppose that you are using a very special application. It may be possible that after a long time of use, the repository from where you downloaded your application is not available any more. It may also be possible that, after a long use, something happened to your device, and you need to reinstall your favorite application.
We are going to explain you a way to keep a copy of the DEB package of your favorite application, so that you can install it again even if the package is not available any more from the repositories.
WARNING: Downloading deb files for all the installed packages may cause the root file-system to be exhausted thereby "bricking" the device. Proceed with caution.
[edit] Needed Tools and Skills
To follow this tutorial, you need root access on your device and the following tools:
- Terminal emulator (X Terminal or SSH)
- VIM editor (Available in Extras)
[edit] Create the Archive folder
- Open a terminal emulator and create the required folders using the following command:
$ mkdir /home/user/MyDocs/apt-archive-cache $ mkdir /home/user/MyDocs/apt-archive-cache/archives $ mkdir /home/user/MyDocs/apt-archive-cache/archives/partial
or the equivalent
$ mkdir -p /home/user/MyDocs/apt-archive-cache/archives/partial
If you wish to use a different folder, substitute /home/user/MyDocs with the desired path.
[edit] Create Package-List
- As a normal user type the following command to create a file (package.list) that contains a list of all the packages installed on the device:
$ dpkg --get-selections|grep install|grep -v deinstall>/home/user/package.list
In case you just want to download a selection of packages from that list, you should edit it and remove the lines you do not need.
For example, if you just want to download a copy of the package abiword, then you should:
- As a normal user type the following command:
$ cat /home/user/package.list|grep abiword>/home/user/package-abiword.list
If you want to download all packages, except one of them: debconf, for example. Then you should:
- As a normal user type the following command:
$ cat /home/user/package.list|grep -v debconf>/home/user/package-without-debconf.list
[edit] Edit Package-List
After previous steps, you have a list with all the desired packages you want to download to your device. In our previous examples this list could be any one of these:
- package.list
- package-abiword.list
- package-without-debconf.list
Now you just need to edit this list in order to use it with apt-get:
- As a normal user type the following command:
$ vim /home/user/package.list
- After vi editor is running, then type the following command:
:%s!install!!
- This last command will clean the lines, removing the word install and leaving just the name of the packages. Now we want to add an order for apt-get to download the desired packages, so type the following command:
:%s!^!apt-get --force-yes -yy -d install --reinstall -o dir::cache=/home/user/MyDocs/apt-archive-cache !
- This last command will add to the beginning of each line the needed instructions for apt-get to only download the packages: -d install --reinstall. In order to prevent the script from stopping at any question we have inserted the --force-yes -yy option. Now we just need to save the file typing the following command:
ZZ
[edit] Download Packages
Executing the package-list script will download the packages.
- To execute the script we need first to get ROOT access.
- Then as ROOT type the following command:
# sh</home/user/package.list
You should now see the downloads in progress.
Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 213kB of archives. After this operation, 0B of additional disk space will be used. Get:1 http://repository.maemo.org fremantle/free 100boxes 0.5.0-4 [213kB] Fetched 213kB in 0s (538kB/s) Download complete and in download only mode
Depending on the size of the list, this could take a long time. After it is completed, the downloaded packages can be listed with the following command:
$ ls /home/user/MyDocs/apt-archive-cache/archives|grep deb Nokia-N900-42-11:/home/user# ls /home/user/MyDocs/apt-archive-cache/archives|grep deb 100boxes_0.5.0-4_armel.deb accdisplay_1.0_armel.deb adblock-plus-1.0_1maemo0-8_all.deb ati85_1.4.1-1_armel.deb battlegweled_0.9-4_armel.deb bluetooth-dun_1.0-2_armel.deb
[edit] Install Package-List
With previous steps you have downloaded all your favourite applications, for backup purposes. Now just imagine that you need to install them again from scratch, then you will need to proceed as follows:
To install all the packages from the list:
- open the package.list file in VIM
- remove the -d option from each of the lines (:%s!-d!!)
- save and execute the file again as root (# sh</home/user/package.list)
If you wish to install an individual package, execute the apt-get command separately for that package by using the specific line from the packages.list file.
Nokia-N900-42-11:/home/user# apt-get --force-yes -yy install --reinstall -o dir::cache=/home/user/MyDocs/apt-archive-cache 100boxes Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0B/213kB of archives. After this operation, 0B of additional disk space will be used. (Reading database ... 36360 files and directories currently installed.) Preparing to replace 100boxes 0.5.0-4 (using .../100boxes_0.5.0-4_armel.deb) ... Unpacking replacement 100boxes ... Setting up 100boxes (0.5.0-4) ...
[edit] Dependencies
- executing package.list will only download the package, not the dependencies. This may create problems during restore when the package dependencies are not available in the archive. Of course, this would only be a problem if the package list was a selection of the entire system package list. When downloading the entire system package list, all packages would be available and dependecies would not be an issue.
- safe way would be to remove the application via 'apt-get remove' and 'apt-get autoremove' and then use the apt-get with the -d and -o option to download the package with the dependencies.
[edit] Further Questions
If you have further questions, do not hesitate to place the question here in this section, and it will be answered in short.
You may also ask for help sending me an e-mail
- This page was last modified on 22 November 2011, at 02:51.
- This page has been accessed 66,802 times.