Class: Raptget::Aptget
- Inherits:
-
Object
- Object
- Raptget::Aptget
- Defined in:
- lib/raptget.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#allow_unauthenticated ⇒ Object
Ignore if packages can’t be authenticated and don’t prompt about it.
-
#arch_only ⇒ Object
Only process architecture-dependent build-dependencies.
-
#assume_yes ⇒ Object
Automatic yes to prompts; assume “yes” as answer to all prompts and run non-interactively.
-
#auto_remove ⇒ Object
If the command is either install or remove, then this option acts like running autoremove command, removing the unused dependency packages.
-
#build ⇒ Object
Compile source packages after downloading them.
-
#compile ⇒ Object
Alias to build.
-
#config_file ⇒ Object
Configuration File; Specify a configuration file to use.
-
#default_release ⇒ Object
This option controls the default input to the policy engine, it creates a default pin at priority 990 using the specified release string.
-
#diff_only ⇒ Object
Download only the diff file of a source archive.
-
#disable_sudo ⇒ Object
Disable sudo.
-
#download_only ⇒ Object
Download only; package files are only retrieved, not unpacked or installed.
-
#dry_run ⇒ Object
Alias to simulate.
-
#dsc_only ⇒ Object
Download only the dsc file of a source archive.
-
#fix_broken ⇒ Object
Fix; attempt to correct a system with broken dependencies in place.
-
#fix_missing ⇒ Object
Ignore missing packages; If packages cannot be retrieved or fail the integrity check after retrieval (corrupted package files), hold back those packages and handle the result.
-
#force_yes ⇒ Object
Force yes; This is a dangerous option that will cause apt to continue without prompting if it is doing something potentially harmful.
-
#ignore_hold ⇒ Object
Ignore package Holds; This causes apt-get to ignore a hold placed on a package.
-
#ignore_missing ⇒ Object
Alias to fix_missing.
-
#install_recommends ⇒ Object
Also install recommended packages.
-
#just_print ⇒ Object
Alias to simulate.
-
#list_cleanup ⇒ Object
This option defaults to on, use ‘no_list_cleanup’ to turn it off.
-
#no_act ⇒ Object
Alias to simulate.
-
#no_download ⇒ Object
Disables downloading of packages.
-
#no_install_recommends ⇒ Object
Do not install recommended packages.
-
#no_remove ⇒ Object
If any packages are to be removed apt-get immediately aborts without prompting.
-
#no_upgrade ⇒ Object
Do not upgrade packages; When used in conjunction with install no-upgrade will prevent packages listed from being upgraded if they are already installed.
-
#only_source ⇒ Object
Only has meaning for the source command.
-
#option ⇒ Object
Set a Configuration Option; This will set an arbitrary configuration option.
-
#print_uris ⇒ Object
Instead of fetching the files to install their URIs are printed.
-
#purge(packages) ⇒ Object
purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
-
#quiet ⇒ Object
Quiet; produces output suitable for logging, omitting progress indicators.
-
#recon ⇒ Object
Alias to simulate.
-
#reinstall ⇒ Object
Re-Install packages that are already installed and at the newest version.
-
#show_upgraded ⇒ Object
Show upgraded packages; Print out a list of all packages that are to be upgraded.
-
#simulate ⇒ Object
No action; perform a simulation of events that would occur but do not actually change the system.
-
#tar_only ⇒ Object
Download only the tar file of a source archive.
-
#target_release ⇒ Object
Alias to default_release.
-
#trivial_only ⇒ Object
Only perform operations that are ‘trivial’.
-
#verbose_version ⇒ Object
Show full versions for upgraded and installed packages.
-
#yes ⇒ Object
Alias to assume_yes.
Instance Method Summary collapse
-
#autoclean ⇒ Object
Like clean, autoclean clears out the local repository of retrieved package files.
-
#autoremove ⇒ Object
autoremove is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
-
#build_dep(packages) ⇒ Object
‘build_dep’ causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.
-
#check ⇒ Object
check is a diagnostic tool; it updates the package cache and checks for broken dependencies.
-
#clean ⇒ Object
clean clears out the local repository of retrieved package files.
-
#dist_upgrade ⇒ Object
dist_upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.
-
#dselect_upgrade ⇒ Object
dselect_upgrade is used in conjunction with the traditional Debian packaging front-end, dselect.
-
#initialize ⇒ Aptget
constructor
Returns a new Raptget Object.
-
#install(packages) ⇒ Object
install is followed by one or more packages desired for installation or upgrading.
-
#remove(packages) ⇒ Object
remove is identical to install except that packages are removed instead of installed.
-
#source(packages) ⇒ Object
source causes apt-get to fetch source packages.
-
#update ⇒ Object
update is used to resynchronize the package index files from their sources.
-
#upgrade ⇒ Object
upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list.
Constructor Details
#initialize ⇒ Aptget
Returns a new Raptget Object
327 328 |
# File 'lib/raptget.rb', line 327 def initialize() end |
Instance Attribute Details
#allow_unauthenticated ⇒ Object
Ignore if packages can’t be authenticated and don’t prompt about it. This is useful for tools like pbuilder. Configuration Item: APT::Get::AllowUnauthenticated.
296 297 298 |
# File 'lib/raptget.rb', line 296 def allow_unauthenticated @allow_unauthenticated end |
#arch_only ⇒ Object
Only process architecture-dependent build-dependencies. Configuration Item: APT::Get::Arch-Only
302 303 304 |
# File 'lib/raptget.rb', line 302 def arch_only @arch_only end |
#assume_yes ⇒ Object
Automatic yes to prompts; assume “yes” as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.
118 119 120 |
# File 'lib/raptget.rb', line 118 def assume_yes @assume_yes end |
#auto_remove ⇒ Object
If the command is either install or remove, then this option acts like running autoremove command, removing the unused dependency packages. Configuration Item: APT::Get::AutomaticRemove.
260 261 262 |
# File 'lib/raptget.rb', line 260 def auto_remove @auto_remove end |
#build ⇒ Object
Compile source packages after downloading them. Configuration Item: APT::Get::Compile.
142 143 144 |
# File 'lib/raptget.rb', line 142 def build @build end |
#compile ⇒ Object
Alias to build
147 148 149 |
# File 'lib/raptget.rb', line 147 def compile @compile end |
#config_file ⇒ Object
Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this configuration file.
309 310 311 |
# File 'lib/raptget.rb', line 309 def config_file @config_file end |
#default_release ⇒ Object
This option controls the default input to the policy engine, it creates a default pin at priority 990 using the specified release string. The preferences file may further override this setting. In short, this option lets you have simple control over which distribution packages will be retrieved from. Some common examples might be ‘default_release = 2.1*’ or ‘default_release = unstable’. Configuration Item: APT::Default-Release;
232 233 234 |
# File 'lib/raptget.rb', line 232 def default_release @default_release end |
#diff_only ⇒ Object
Download only the diff file of a source archive. Configuration Item: APT::Get::Diff-Only
289 290 291 |
# File 'lib/raptget.rb', line 289 def diff_only @diff_only end |
#disable_sudo ⇒ Object
Disable sudo. If this is not set, sudo is used.
322 323 324 |
# File 'lib/raptget.rb', line 322 def disable_sudo @disable_sudo end |
#download_only ⇒ Object
Download only; package files are only retrieved, not unpacked or installed. Configuration Item: APT::Get::Download-Only.
26 27 28 |
# File 'lib/raptget.rb', line 26 def download_only @download_only end |
#dry_run ⇒ Object
Alias to simulate
99 100 101 |
# File 'lib/raptget.rb', line 99 def dry_run @dry_run end |
#dsc_only ⇒ Object
Download only the dsc file of a source archive. Configuration Item: APT::Get::Dsc-Only
283 284 285 |
# File 'lib/raptget.rb', line 283 def dsc_only @dsc_only end |
#fix_broken ⇒ Object
Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. Any Package that are specified must completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system’s dependency structure can be so corrupt as to require manual intervention (which usually means using dselect or ‘remove’ to eliminate some of the offending packages). Use of this option together with ‘fix_missing’ may produce an error in some situations. Configuration Item: APT::Get::Fix-Broken.
42 43 44 |
# File 'lib/raptget.rb', line 42 def fix_broken @fix_broken end |
#fix_missing ⇒ Object
Ignore missing packages; If packages cannot be retrieved or fail the integrity check after retrieval (corrupted package files), hold back those packages and handle the result. Use of this option together with ‘fix_broken’ may produce an error in some situations. If a package is selected for installation (particularly if it is mentioned on the command line) and it could not be downloaded then it will be silently held back. Configuration Item: APT::Get::Fix-Missing.
54 55 56 |
# File 'lib/raptget.rb', line 54 def fix_missing @fix_missing end |
#force_yes ⇒ Object
Force yes; This is a dangerous option that will cause apt to continue without prompting if it is doing something potentially harmful. It should not be used except in very special situations. Using ‘force_yes’ can potentially destroy your system! Configuration Item: APT::Get::force-yes.
183 184 185 |
# File 'lib/raptget.rb', line 183 def force_yes @force_yes end |
#ignore_hold ⇒ Object
Ignore package Holds; This causes apt-get to ignore a hold placed on a package. This may be useful in conjunction with dist-upgrade to override a large number of undesired holds. Configuration Item: APT::Ignore-Hold.
166 167 168 |
# File 'lib/raptget.rb', line 166 def ignore_hold @ignore_hold end |
#ignore_missing ⇒ Object
Alias to fix_missing
59 60 61 |
# File 'lib/raptget.rb', line 59 def ignore_missing @ignore_missing end |
#install_recommends ⇒ Object
Also install recommended packages.
152 153 154 |
# File 'lib/raptget.rb', line 152 def install_recommends @install_recommends end |
#just_print ⇒ Object
Alias to simulate
94 95 96 |
# File 'lib/raptget.rb', line 94 def just_print @just_print end |
#list_cleanup ⇒ Object
This option defaults to on, use ‘no_list_cleanup’ to turn it off. When on apt-get will automatically manage the contents of /var/lib/apt/lists to ensure that obsolete files are erased. The only reason to turn it off is if you frequently change your source list. Configuration Item: APT::Get::List-Cleanup.
220 221 222 |
# File 'lib/raptget.rb', line 220 def list_cleanup @list_cleanup end |
#no_act ⇒ Object
Alias to simulate
109 110 111 |
# File 'lib/raptget.rb', line 109 def no_act @no_act end |
#no_download ⇒ Object
Disables downloading of packages. This is best used with ignore_missing to force APT to use only the .debs it has already downloaded. Configuration Item: APT::Get::Download.
67 68 69 |
# File 'lib/raptget.rb', line 67 def no_download @no_download end |
#no_install_recommends ⇒ Object
Do not install recommended packages.
157 158 159 |
# File 'lib/raptget.rb', line 157 def no_install_recommends @no_install_recommends end |
#no_remove ⇒ Object
If any packages are to be removed apt-get immediately aborts without prompting. Configuration Item: APT::Get::Remove
252 253 254 |
# File 'lib/raptget.rb', line 252 def no_remove @no_remove end |
#no_upgrade ⇒ Object
Do not upgrade packages; When used in conjunction with install no-upgrade will prevent packages listed from being upgraded if they are already installed. Configuration Item: APT::Get::Upgrade.
174 175 176 |
# File 'lib/raptget.rb', line 174 def no_upgrade @no_upgrade end |
#only_source ⇒ Object
Only has meaning for the source command. Indicates that the given source names are not to be mapped through the binary table. This means that if this option is specified, the source command will only accept source package names as arguments, rather than accepting binary package names and looking up the corresponding source package. Configuration Item: APT::Get::Only-Source
271 272 273 |
# File 'lib/raptget.rb', line 271 def only_source @only_source end |
#option ⇒ Object
Set a Configuration Option; This will set an arbitrary configuration option. The syntax is raptget.option = “Foo::Bar=bar”
316 317 318 |
# File 'lib/raptget.rb', line 316 def option @option end |
#print_uris ⇒ Object
Instead of fetching the files to install their URIs are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.
195 196 197 |
# File 'lib/raptget.rb', line 195 def print_uris @print_uris end |
#purge(packages) ⇒ Object
purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
203 204 205 |
# File 'lib/raptget.rb', line 203 def purge @purge end |
#quiet ⇒ Object
Quiet; produces output suitable for logging, omitting progress indicators. You can also use ‘quiet=#’ to set the quiet level, overriding the configuration file. Note that quiet level 2 implies ‘yes’, you should never use ‘quiet=2’ without a no-action modifier such as ‘download_only’, ‘print_uris’ or ‘simulate’ as APT may decided to do something you did not expect. Configuration Item: quiet.
78 79 80 |
# File 'lib/raptget.rb', line 78 def quiet @quiet end |
#recon ⇒ Object
Alias to simulate
104 105 106 |
# File 'lib/raptget.rb', line 104 def recon @recon end |
#reinstall ⇒ Object
Re-Install packages that are already installed and at the newest version. Configuration Item: APT::Get::ReInstall.
210 211 212 |
# File 'lib/raptget.rb', line 210 def reinstall @reinstall end |
#show_upgraded ⇒ Object
Show upgraded packages; Print out a list of all packages that are to be upgraded. Configuration Item: APT::Get::Show-Upgraded.
130 131 132 |
# File 'lib/raptget.rb', line 130 def show_upgraded @show_upgraded end |
#simulate ⇒ Object
No action; perform a simulation of events that would occur but do not actually change the system. Configuration Item: APT::Get::Simulate. Simulate prints out a series of lines each one representing a dpkg operation, Configure (Conf), Remove (Remv), Unpack (Inst). Square brackets indicate broken packages with and empty set of square brackets meaning breaks that are of no consequence (rare).
89 90 91 |
# File 'lib/raptget.rb', line 89 def simulate @simulate end |
#tar_only ⇒ Object
Download only the tar file of a source archive. Configuration Item: APT::Get::Tar-Only
277 278 279 |
# File 'lib/raptget.rb', line 277 def tar_only @tar_only end |
#target_release ⇒ Object
Alias to default_release
237 238 239 |
# File 'lib/raptget.rb', line 237 def target_release @target_release end |
#trivial_only ⇒ Object
Only perform operations that are ‘trivial’. Logically this can be considered related to ‘assume_yes’, where ‘assume_yes’ will answer yes to any prompt, ‘trivial_only’ will answer no. Configuration Item: APT::Get::Trivial-Only.
245 246 247 |
# File 'lib/raptget.rb', line 245 def trivial_only @trivial_only end |
#verbose_version ⇒ Object
Show full versions for upgraded and installed packages. Configuration Item: APT::Get::Show-Versions.
136 137 138 |
# File 'lib/raptget.rb', line 136 def verbose_version @verbose_version end |
#yes ⇒ Object
Alias to assume_yes
123 124 125 |
# File 'lib/raptget.rb', line 123 def yes @yes end |
Instance Method Details
#autoclean ⇒ Object
Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
# File 'lib/raptget.rb', line 695 def autoclean tmp = Tempfile.new('raptget_autoclean') command = option_string() + "autoclean " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#autoremove ⇒ Object
autoremove is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
# File 'lib/raptget.rb', line 720 def autoremove tmp = Tempfile.new('raptget_autoremove') command = option_string() + "autoremove " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /Removing/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#build_dep(packages) ⇒ Object
‘build_dep’ causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
# File 'lib/raptget.rb', line 627 def build_dep(packages) tmp = Tempfile.new('raptget_build_dep') packages.collect! { |i| i + " " } command = option_string() + "build-dep " + packages.to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#check ⇒ Object
check is a diagnostic tool; it updates the package cache and checks for broken dependencies.
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/raptget.rb', line 666 def check tmp = Tempfile.new('raptget_check') command = option_string() + "check " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#clean ⇒ Object
clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When APT is used as a dselect method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space.
656 657 658 659 660 661 662 |
# File 'lib/raptget.rb', line 656 def clean command = option_string() + "clean " success = system(command) return success end |
#dist_upgrade ⇒ Object
dist_upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. So, ‘dist_upgrade’ command may remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences for a mechanism for overriding the general settings for individual packages.
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/raptget.rb', line 499 def dist_upgrade tmp = Tempfile.new('raptget_dist_upgrade') command = option_string() + "dist-upgrade " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /^Setting up/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#dselect_upgrade ⇒ Object
dselect_upgrade is used in conjunction with the traditional Debian packaging front-end, dselect. ‘dselect_upgrade’ follows the changes made by dselect to the Status field of available packages, and performs the actions necessary to realize that state (for instance, the removal of old and the installation of new packages).
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/raptget.rb', line 468 def dselect_upgrade tmp = Tempfile.new('raptget_dselect_upgrade') command = option_string() + "dselect-upgrade " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /^Setting up/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#install(packages) ⇒ Object
install is followed by one or more packages desired for installation or upgrading. Each package is a package name, not a fully qualified filename (for instance, in a Debian GNU/Linux system, libc6 would be the argument provided, not libc6_1.9.6-2.deb). All packages required by the package(s) specified for installation will also be retrieved and installed. The /etc/apt/sources.list file is used to locate the desired packages. If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. Similarly a plus sign can be used to designate a package to install. These latter features may be used to override decisions made by apt-get’s conflict resolution system.
A specific version of a package can be selected for installation by following the package name with an equals and the version of the package to select. This will cause that version to be located and selected for install. Alternatively a specific distribution can be selected by following the package name with a slash and the version of the distribution or the Archive name (stable, testing, unstable).
Both of the version selection mechanisms can downgrade packages and must be used with care.
This is also the target to use if you want to upgrade one or more already-installed packages without upgrading every package you have on your system. Unlike the “upgrade” target, which installs the newest version of all currently installed packages, “install” will install the newest version of only the package(s) specified. Simply provide the name of the package(s) you wish to upgrade, and if a newer version is available, it (and its dependencies, as described above) will be downloaded and installed.
Finally, the apt_preferences mechanism allows you to create an alternative installation policy for individual packages.
If no package matches the given expression and the expression contains one of ‘.’, ‘?’ or ‘*’ then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so ‘lo.*’ matches ‘how-lo’ and ‘lowest’. If this is undesired, anchor the regular expression with a ‘^’ or ‘$’ character, or create a more specific regular expression.
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/raptget.rb', line 376 def install(packages) tmp = Tempfile.new('raptget_install') packages.collect! { |i| i + " " } command = option_string() + "install " + packages.to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /Setting up/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#remove(packages) ⇒ Object
remove is identical to install except that packages are removed instead of installed. Note the removing a package leaves its configuration files in system. If a plus sign is appended to the package name (with no intervening space), the identified package will be installed instead of removed.
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/raptget.rb', line 526 def remove(packages) tmp = Tempfile.new('raptget_remove') packages.collect! { |i| i + " " } command = option_string() + "remove " + packages.to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /Removing/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#source(packages) ⇒ Object
source causes apt-get to fetch source packages. APT will examine the available packages to decide which source package to fetch. It will then find and download into the current directory the newest available version of that source package while respect the default release, set with the option APT::Default-Release, the ‘target_release’ option or per package with the pkg/release syntax, if possible.
Source packages are tracked separately from binary packages via deb-src type lines in the sources.list file. This means that you will need to add such a line for each repository you want to get sources from. If you don’t do this you will properly get another (newer, older or none) source version than the one you have installed or could install.
If the ‘compile’ option is specified then the package will be compiled to a binary .deb using dpkg-buildpackage, if ‘download_only’ is specified then the source package will not be unpacked.
A specific source version can be retrieved by postfixing the source name with an equals and then the version to fetch, similar to the mechanism used for the package files. This enables exact matching of the source package name and version, implicitly enabling the APT::Get::Only-Source option.
Note that source packages are not tracked like binary packages, they exist only in the current directory and are similar to downloading source tar balls.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/raptget.rb', line 602 def source(packages) tmp = Tempfile.new('raptget_source') packages.collect! { |i| i + " " } command = option_string() + "source " + packages.to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#update ⇒ Object
update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the overall progress meter will be incorrect as the size of the package files cannot be known in advance.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/raptget.rb', line 408 def update tmp = Tempfile.new('raptget_update') command = option_string() + "update " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /Hit/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |
#upgrade ⇒ Object
upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/raptget.rb', line 440 def upgrade tmp = Tempfile.new('raptget_upgrade') command = option_string() + "upgrade " + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line if line =~ /^Setting up/ end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |