mirror of
https://github.com/fspc/dswim.git
synced 2025-02-22 00:23:28 -05:00
Added --build-dep.
This commit is contained in:
parent
e13572c82e
commit
cce64f4874
27
SWIM/File.pm
27
SWIM/File.pm
@ -541,17 +541,30 @@ sub file {
|
||||
|
||||
untie %db;
|
||||
|
||||
if (defined $file_now &&
|
||||
|
||||
!($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"})) {
|
||||
|
||||
if ($commands{"x"} ||
|
||||
$commands{"ftp"} ||
|
||||
$commands{"source"} ||
|
||||
$commands{"source_only"} ||
|
||||
$commands{"remove"} ||
|
||||
$commands{"r"} ||
|
||||
$commands{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
if (defined $file_now && !($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"} || $commands->{"reinstall"})) {
|
||||
if ($commands{"x"} || $commands{"ftp"} || $commands{"source"} ||
|
||||
$commands{"source_only"} || $commands{"remove"} ||
|
||||
$commands{"r"} || $commands{"purge"} || $commands->{"reinstall"} ) {
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
100
SWIM/Findex.pm
100
SWIM/Findex.pm
@ -67,9 +67,14 @@ sub findexer {
|
||||
my $package = $ib{"$argument"};
|
||||
@alot = split(/\s/, $package);
|
||||
@PACKAGES = @alot;
|
||||
if ($commands->{"z"} || $commands->{"ftp"} ||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"} || $commands->{"reinstall"}) {
|
||||
if ($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
@ -79,9 +84,13 @@ sub findexer {
|
||||
if ($commands->{"T"}) {
|
||||
foreach (@alot) {
|
||||
$argument = $_;
|
||||
if ($commands->{"scripts"} || $commands->{"preinst"} ||
|
||||
$commands->{"postinst"} || $commands->{"prerm"} ||
|
||||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} ) {
|
||||
if ($commands->{"scripts"} ||
|
||||
$commands->{"preinst"} ||
|
||||
$commands->{"postinst"} ||
|
||||
$commands->{"prerm"} ||
|
||||
$commands->{"postrm"} ||
|
||||
$commands->{"config"} ||
|
||||
$commands->{"templates"} ) {
|
||||
scripts(\%commands);
|
||||
}
|
||||
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
|
||||
@ -123,9 +132,13 @@ sub findexer {
|
||||
# no -Ts.
|
||||
foreach (@alot) {
|
||||
$argument = $_;
|
||||
if ($commands->{"scripts"} || $commands->{"preinst"} ||
|
||||
$commands->{"postinst"} || $commands->{"prerm"} ||
|
||||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
|
||||
if ($commands->{"scripts"} ||
|
||||
$commands->{"preinst"} ||
|
||||
$commands->{"postinst"} ||
|
||||
$commands->{"prerm"} ||
|
||||
$commands->{"postrm"} ||
|
||||
$commands->{"config"} ||
|
||||
$commands->{"templates"}) {
|
||||
scripts(\%commands);
|
||||
}
|
||||
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
|
||||
@ -158,9 +171,14 @@ sub findexer {
|
||||
if ($commands->{"T"}) {
|
||||
foreach (@alot) {
|
||||
$argument = $_;
|
||||
if ($commands->{"scripts"} || $commands->{"preinst"} ||
|
||||
$commands->{"postinst"} || $commands->{"prerm"} ||
|
||||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
|
||||
if ($commands->{"scripts"} ||
|
||||
$commands->{"preinst"} ||
|
||||
$commands->{"postinst"} ||
|
||||
$commands->{"prerm"} ||
|
||||
$commands->{"postrm"} ||
|
||||
$commands->{"config"} ||
|
||||
$commands->{"templates"}) {
|
||||
|
||||
scripts(\%commands);
|
||||
}
|
||||
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
|
||||
@ -198,9 +216,13 @@ sub findexer {
|
||||
} # which_character
|
||||
foreach (@alot) {
|
||||
$argument = $_;
|
||||
if ($commands->{"scripts"} || $commands->{"preinst"} ||
|
||||
$commands->{"postinst"} || $commands->{"prerm"} ||
|
||||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
|
||||
if ($commands->{"scripts"} ||
|
||||
$commands->{"preinst"} ||
|
||||
$commands->{"postinst"} ||
|
||||
$commands->{"prerm"} ||
|
||||
$commands->{"postrm"} ||
|
||||
$commands->{"config"} ||
|
||||
$commands->{"templates"}) {
|
||||
scripts(\%commands);
|
||||
}
|
||||
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
|
||||
@ -241,13 +263,25 @@ sub findexer {
|
||||
}
|
||||
untie %ib;
|
||||
|
||||
if (!($commands->{"z"} || $commands->{"ftp"} ||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"}|| $commands->{"reinstall"} )) {
|
||||
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} ||
|
||||
$commands->{"source_only"} || $commands->{"remove"} ||
|
||||
$commands->{"r"} || $commands->{"purge"}|| $commands->{"reinstall"} ) {
|
||||
if (!($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"} )) {
|
||||
|
||||
if ($commands->{"x"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"source"} ||
|
||||
$commands->{"source_only"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"} ) {
|
||||
require SWIM::Safex;
|
||||
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
}
|
||||
@ -264,10 +298,15 @@ sub qindexer {
|
||||
require SWIM::Ag;
|
||||
SWIM::Ag->import(qw(description));
|
||||
|
||||
if ($commands->{"scripts"} || $commands->{"preinst"} ||
|
||||
$commands->{"postinst"} || $commands->{"prerm"} ||
|
||||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
|
||||
scripts(\%commands);
|
||||
if ($commands->{"scripts"} ||
|
||||
$commands->{"preinst"} ||
|
||||
$commands->{"postinst"} ||
|
||||
$commands->{"prerm"} ||
|
||||
$commands->{"postrm"} ||
|
||||
$commands->{"config"} ||
|
||||
$commands->{"templates"}) {
|
||||
|
||||
scripts(\%commands);
|
||||
}
|
||||
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
|
||||
copyright(\%commands) if $commands->{"copyright"};
|
||||
@ -296,9 +335,14 @@ sub qindexer {
|
||||
my $package = $ib{"$argument"};
|
||||
@alot = split(/\s/, $package);
|
||||
@PACKAGES = @alot;
|
||||
if ($commands->{"z"} || $commands->{"ftp"} ||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"} || $commands->{"reinstall"}) {
|
||||
if ($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
|
@ -354,12 +354,17 @@ sub indexer {
|
||||
if (@alot) {
|
||||
@PACKAGES = @alot;
|
||||
}
|
||||
if ($commands->{"z"} || $commands->{"ftp"}||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"} || $commands->{"reinstall"}) {
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
if ($commands->{"z"} ||
|
||||
$commands->{"ftp"}||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
}
|
||||
|
||||
|
||||
@ -496,15 +501,27 @@ sub indexer {
|
||||
if (@alot) {
|
||||
@PACKAGES = @alot;
|
||||
}
|
||||
if (!($commands->{"z"} || $commands->{"ftp"} ||
|
||||
$commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"purge"} || $commands->{"reinstall"})) {
|
||||
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} ||
|
||||
$commands->{"source_only"} || $commands->{"remove"} ||
|
||||
$commands->{"r"} || $commands->{"purge"} || $commands->{"reinstall"}) {
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
if (!($commands->{"z"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"})) {
|
||||
|
||||
if ($commands->{"x"} ||
|
||||
$commands->{"ftp"} ||
|
||||
$commands->{"source"} ||
|
||||
$commands->{"source_only"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
require SWIM::Safex;
|
||||
SWIM::Safex->import(qw(safex));
|
||||
safex(\%commands);
|
||||
}
|
||||
}
|
||||
|
||||
|
123
SWIM/Safex.pm
123
SWIM/Safex.pm
@ -42,7 +42,8 @@ sub safex {
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"}) {
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
|
||||
|
||||
if (!defined @PACKAGES) {
|
||||
@ -75,7 +76,8 @@ sub safex {
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"reinstall"} ) {
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"} ) {
|
||||
if ($PACKAGES[$#PACKAGES] =~ /_/) {
|
||||
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,;
|
||||
$aptor = $1;
|
||||
@ -97,7 +99,8 @@ sub safex {
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"reinstall"}) {
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) {
|
||||
if ($PACKAGES[$#PACKAGES] =~ /_/) {
|
||||
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,;
|
||||
$aptor = $1;
|
||||
@ -189,32 +192,49 @@ sub xyz {
|
||||
($commands->{"r"} ||
|
||||
$commands->{"remove"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"}) ) {
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"}) ) {
|
||||
|
||||
print "swim: --ftp cannot be used with ";
|
||||
print "-r " if defined $commands->{"r"};
|
||||
print "--remove " if defined $commands->{"remove"};
|
||||
print "--purge " if defined $commands->{"purge"};
|
||||
print "--reinstall " if defined $commands->{"reinstall"};
|
||||
print "--build-dep " if defined $commands->{"build-dep"};
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
if ((($commands->{"r"} ||
|
||||
if (
|
||||
|
||||
(($commands->{"r"} ||
|
||||
$commands->{"remove"}) &&
|
||||
$commands->{"purge"}) ||
|
||||
|
||||
(($commands->{"r"} ||
|
||||
$commands->{"remove"}) &&
|
||||
$commands->{"build-dep"}) ||
|
||||
|
||||
(($commands->{"r"} ||
|
||||
$commands->{"remove"}) &&
|
||||
$commands->{"reinstall"}) ||
|
||||
|
||||
($commands->{"reinstall"} &&
|
||||
$commands->{"purge"}) ||
|
||||
|
||||
($commands->{"reinstall"} &&
|
||||
$commands->{"purge"})
|
||||
) {
|
||||
$commands->{"build-dep"}) ||
|
||||
|
||||
($commands->{"purge"} &&
|
||||
$commands->{"build-dep"})
|
||||
|
||||
) {
|
||||
|
||||
print "swim: ";
|
||||
print "-r " if defined $commands->{"r"};
|
||||
print "--remove " if defined $commands->{"remove"};
|
||||
print "--purge " if defined $commands->{"purge"};
|
||||
print "--reinstall " if defined $commands->{"reinstall"};
|
||||
print "--build-dep " if defined $commands->{"build-dep"};
|
||||
print "cannot be used together\n";
|
||||
exit;
|
||||
}
|
||||
@ -342,6 +362,9 @@ sub xyz {
|
||||
elsif ( $commands->{"reinstall"} ) {
|
||||
system "$apt_get --reinstall install -qs $arg";
|
||||
}
|
||||
elsif ( $commands->{"build-dep"} ) {
|
||||
system "$apt_get build-dep -qs $arg";
|
||||
}
|
||||
else {
|
||||
system "$apt_get install -qs $arg";
|
||||
}
|
||||
@ -401,6 +424,9 @@ sub xyz {
|
||||
elsif ( $commands->{"reinstall"} ) {
|
||||
system "$apt_get --reinstall install -qds $arg";
|
||||
}
|
||||
elsif ( $commands->{"build-dep"} ) {
|
||||
system "$apt_get build-dep -qds $arg";
|
||||
}
|
||||
else {
|
||||
system "$apt_get install -qds $arg";
|
||||
}
|
||||
@ -452,33 +478,43 @@ sub xyz {
|
||||
#######
|
||||
# XYZ #
|
||||
#######
|
||||
if (!($commands->{"ftp"} || $commands->{"purge"} ||
|
||||
$commands->{"reinstall"})) {
|
||||
if (!$commands->{"y"}) {
|
||||
if (!$commands->{"download-only"}) {
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install $arg" :
|
||||
system "$apt_get remove $arg";
|
||||
}
|
||||
else {
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get -d install $arg" :
|
||||
system "$apt_get remove $arg";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$commands->{"download-only"}) {
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install -y $arg" :
|
||||
system "$apt_get remove -y $arg";
|
||||
}
|
||||
else {
|
||||
# not that the y does anything
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install -y -d $arg" :
|
||||
system "$apt_get remove -y $arg";
|
||||
}
|
||||
}
|
||||
if (
|
||||
!($commands->{"ftp"} ||
|
||||
$commands->{"purge"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"} )
|
||||
|
||||
) {
|
||||
|
||||
if (!$commands->{"y"}) {
|
||||
if (!$commands->{"download-only"}) {
|
||||
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install $arg" :
|
||||
system "$apt_get remove $arg";
|
||||
}
|
||||
else {
|
||||
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get -d install $arg" :
|
||||
system "$apt_get remove $arg";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$commands->{"download-only"}) {
|
||||
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install -y $arg" :
|
||||
system "$apt_get remove -y $arg";
|
||||
}
|
||||
else {
|
||||
|
||||
# not that the y does anything or d for that matter
|
||||
!($commands->{"r"} || $commands{"remove"}) ?
|
||||
system "$apt_get install -y -d $arg" :
|
||||
system "$apt_get remove -y $arg";
|
||||
}
|
||||
}
|
||||
}
|
||||
#######
|
||||
# FTP #
|
||||
@ -489,12 +525,17 @@ sub xyz {
|
||||
qftp($arg,\%commands);
|
||||
}
|
||||
|
||||
##############################
|
||||
# PURGE & REMOVE & REINSTALL #
|
||||
##############################
|
||||
elsif ($commands->{"purge"} || $commands->{"remove"} || $commands->{"r"} ||
|
||||
$commands->{"reinstall"}) {
|
||||
##########################################
|
||||
# PURGE & REMOVE & REINSTALL & BUILD-DEP #
|
||||
#########################################
|
||||
elsif ($commands->{"purge"} || $
|
||||
commands->{"remove"} ||
|
||||
$commands->{"r"} ||
|
||||
$commands->{"reinstall"} ||
|
||||
$commands->{"build-dep"} ) {
|
||||
|
||||
purge($arg,\%commands);
|
||||
|
||||
}
|
||||
|
||||
# this is a good time to return the versions, too, as well as
|
||||
@ -530,6 +571,9 @@ sub purge {
|
||||
elsif ($commands->{"reinstall"}) {
|
||||
system "$apt_get --reinstall install $arg";
|
||||
}
|
||||
elsif ($commands->{"build-dep"}) {
|
||||
system "$apt_get build-dep $arg";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "swim: ";
|
||||
@ -537,6 +581,7 @@ sub purge {
|
||||
print "--remove " if defined $commands->{"remove"};
|
||||
print "--purge " if defined $commands->{"purge"};
|
||||
print "--reinstall " if defined $commands->{"reinstall"};
|
||||
print "--build-dep " if defined $commands->{"build-dep"};
|
||||
print "can only be used with installed packages\n";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user