Created
June 19, 2023 13:53
-
-
Save earnhardt3rd/3fca98ac33a13c7dd2ca606ef0dc41a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'getopts.pl'; | |
| Getopts('m:d:t'); | |
| my $MODE = uc($opt_m) || ""; | |
| my $DEBUG = $opt_d || 0; | |
| if (defined $opt_t) { my %TEST = &_ADD2PAC();} | |
| 1; | |
| sub _ADD2PAC { | |
| my $input = shift || ""; | |
| my $ext = shift || ""; | |
| my $PACKAGE = shift || "NEXT_RELEASE"; | |
| my @FLIST; | |
| if ($input ne "") { | |
| my @FILES; | |
| if (-d $input) { | |
| my $P=&Parent($input); | |
| my $D=&File($input); | |
| my $fullPath= $P . $SLASH . $D; | |
| opendir(LP,$fullPath); | |
| if ($ext eq "") { | |
| @FILES = grep !/\.\.?$/, readdir(LP); | |
| } else { | |
| #@FILES = grep !/\.\.?$/, readdir(LP); | |
| @FILES = grep { /${ext}/ } readdir(LP); | |
| } | |
| closedir(LP); | |
| if (uc($MODE) eq "CRON") { | |
| for (my $fi=0;$fi<=scalar(@FILES)-1 ;$fi++) { | |
| my $add_file = $fullPath . $SLASH . $FILES[$fi]; | |
| push(@FLIST,$add_file); | |
| } | |
| } else { | |
| my @TLIST=&fromARRAY(@FILES); | |
| for (my $ti=0;$ti<=scalar(@TLIST)-1 ;$ti++) { | |
| my $add_file = $input . $SLASH . $TLIST[$ti]; | |
| push(@FLIST,$add_file); | |
| } | |
| } | |
| } else { | |
| if (-f $input) { | |
| my $P=&Parent($input); | |
| my $F=&File($input); | |
| my $fullPath= $P . $SLASH . $F; | |
| push(@FLIST,$fullPath); | |
| } | |
| } | |
| } else { | |
| my %ADD_HASH = &_GET_FILES(); | |
| if (scalar(keys %ADD_HASH) > 0) { | |
| my @ADD_ARRAY; | |
| foreach my $okey(sort keys %ADD_HASH) { | |
| push(@ADD_ARRAY,$okey); | |
| } | |
| my @ADD_LIST = &fromARRAY(@ADD_ARRAY); | |
| if (scalar(@ADD_LIST) > 0) { | |
| for (my $oi=0;$oi<=scalar(@ADD_LIST)-1 ;$oi++) { | |
| printf " OTB(%0.2d): %-s\n",$oi,$ADD_LIST[$oi]; | |
| if (exists($ADD_HASH{$ADD_LIST[$oi]})) { | |
| my @OTB_PATHS = split($PIT,$ADD_HASH{$ADD_LIST[$oi]}); | |
| if (scalar(@OTB_PATHS) > 0) { | |
| for (my $pi=0;$pi<=scalar(@OTB_PATHS)-1 ;$pi++) { | |
| my $add_file = $OTB_PATHS[$pi] . $SLASH . $ADD_LIST[$oi]; | |
| push(@FLIST,$add_file); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment