diff options
author | Staszek Wawrykiewicz <staw@gust.org.pl> | 2007-02-06 12:02:32 +0000 |
---|---|---|
committer | Staszek Wawrykiewicz <staw@gust.org.pl> | 2007-02-06 12:02:32 +0000 |
commit | bd86f888704af73c7082e6ee7295b759acebcfcc (patch) | |
tree | 66a21699ff8f4fca1b5973662451ca1ab9724520 /Master/setuptl/tlpm-darwin-univ-aqua.pl | |
parent | 15472b04cfb5095b17f972d5bb070d98985c0020 (diff) |
tlpmgui 1.74
git-svn-id: svn://tug.org/texlive/trunk@3940 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/setuptl/tlpm-darwin-univ-aqua.pl')
-rwxr-xr-x | Master/setuptl/tlpm-darwin-univ-aqua.pl | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/Master/setuptl/tlpm-darwin-univ-aqua.pl b/Master/setuptl/tlpm-darwin-univ-aqua.pl new file mode 100755 index 00000000000..8d38165e6b8 --- /dev/null +++ b/Master/setuptl/tlpm-darwin-univ-aqua.pl @@ -0,0 +1,150 @@ +#!/usr/bin/env perl +# This file belongs to TLPM v2.21, TeX Live Package Manager +# Public Domain, P.Jackowski@gust.org.pl + +BEGIN{$tlpm_version="2.21";$tlpm_os="i386-darwin"} + +# the main tlpm script + +use TLPM::common; +use TLPM::constants; + +use TLPM::pkg; +use TLPM::reg; +use TLPM::cmdl; + +use TLPM::list; +use TLPM::incl; +use TLPM::blng; +use TLPM::inst; +use TLPM::uninst; +use TLPM::check; +use TLPM::help; +use TLPM::info; + +%commands = +( + 'exit' => sub {exit(0)}, + 'quit' => sub {exit(0)}, + 'list' => \&list, + 'incl' => \&incl, + 'blng' => \&blng, + 'inst' => \&inst, + 'uninst' => \&uninst, + 'check' => \&check, + 'info' => \&info, + 'help' => \&help, +# 'Help' => \&readme, +# 'readme' => \&readme, +# 'version' => \&version, + 'cmd' => \&sys, + 'set' => \&set +); + +# interactive mode + +sub prompt +{ + local ($cmd_name,@cmd_args,$cmd_line); + while($true) + { + print STDOUT $tlpm_prompt; + $cmd_line = <STDIN>; + exit(0) unless defined $cmd_line; # otherwise looop after 'echo <command> | tlpm' + chomp $cmd_line; + &execute_cmd(); + } +} + +# batch mode + +sub batch +{ + local ($cmd_name,@cmd_args,$cmd_line); + local *INP; + &norm_path($batch_file); + $batch_file = &rel2abs($batch_file,$curr_dir); + open(INP,"<$batch_file") or exit $error{'wrong_inp'} -> ($batch_file); + $message -> ("Executing batch file '$batch_file'"); + foreach $cmd_line (<INP>) + { + exit(0) unless defined $cmd_line; + chomp $cmd_line; + next if $cmd_line =~ /\A\s*(%|#|\z)/; # comment + print STDOUT $tlpm_prompt . $cmd_line . "\n"; + &execute_cmd(); + } + close INP; +} + +sub execute_cmd +{ + my $err; + &resolve_env($cmd_line); + &set_out($cmd_line); + &open_out(); + @cmd_args = &parse_cmd($cmd_line); + return(0) unless @cmd_args; # return prompt on ENTER + $cmd_name = shift @cmd_args; + if(defined $commands{$cmd_name}) + { + $err = $commands{$cmd_name} -> (@cmd_args); + } + else + { + $err = $error{'wrong_cmd'} -> ($cmd_name,'help'); + } + &close_out(); + return $err; +} + +# the main procedure + +sub main +{ + my ($arg,@args); + @args = &parse_cmd(join(" ",@ARGV)); + while(defined($arg = shift @args)) + { + $arg eq '' and next +# or &no_opt($arg) and return $error{'wrong_cmd'} -> ($arg,'tlpm --help') + or &no_opt($arg) and do {$tl_binaries{$arg} = $true} + or &is_opt($arg,'d','directory') and do {$tl_target = shift @args;1} + or &is_opt($arg,'s','source') and do {$tl_source = shift @args;1} + or &is_opt($arg,'v','version') and return $heeelp -> ('tlpm_banner') + or &is_opt($arg,'h','help') and return &help(shift @args) + or &is_opt($arg,'H','Help','readme') and return &readme() + or &is_opt($arg,'b','batch') and do {$batch_file = shift @args;$batch_mode = 1} +# or &is_opt($arg,'q','quiet') and do {$quiet_mode = 1} + or &is_opt($arg,'D','debug') and do {&enable_dbg();} + or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'tlpm --help'); + } + unless(defined $tl_source){$tl_source = $ENV{'tl_source'}}# ...or remains undefined + unless(defined $tl_target){$tl_target = $ENV{'tl_target'}} + $tl_source_indeed = $false; # we need to check the source availability anyway + unless(defined %tl_binaries) # new; installing not only native binaries + { + %tl_binaries = ($tlpm_os => $true); + } + $tl_target_indeed = $false; + if($batch_mode) + { + &batch($batch_file); + } + else + { + $heeelp -> ('tlpm_banner'); + $heeelp -> ('type_help'); + &prompt(); + } +} + +#$quiet_mode = 0; +¬2log(); +&disable_dbg(); +$batch_mode = 0; +$batch_file = ''; + +&main(); + +# uff |