#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. global doit := $(DOITPROG-) # put in absolute paths if you don't have them in your path; or use env. vars. global mvprog := $(MVPROG-mv) global cpprog := $(CPPROG-cp) global chmodprog := $(CHMODPROG-chmod) global chownprog := $(CHOWNPROG-chown) global chgrpprog := $(CHGRPPROG-chgrp) global stripprog := $(STRIPPROG-strip) global rmprog := $(RMPROG-rm) global mkdirprog := $(MKDIRPROG-mkdir) global tranformbasename := ''"" global transform_arg := ''"" global instcmd := $mvprog global chmodcmd := ""$chmodprog 0755"" global chowncmd := ''"" global chgrpcmd := ''"" global stripcmd := ''"" global rmcmd := ""$rmprog -f"" global mvcmd := $mvprog global src := ''"" global dst := ''"" global dir_arg := ''"" while [ x"$1" != x ] { matchstr $1 { -c { global instcmd := $cpprog shift continue} -d { global dir_arg := 'true' shift continue} -m { global chmodcmd := ""$chmodprog $2"" shift shift continue} -o { global chowncmd := ""$chownprog $2"" shift shift continue} -g { global chgrpcmd := ""$chgrpprog $2"" shift shift continue} -s { global stripcmd := $stripprog shift continue} -t=* { global transformarg := $[echo $1 | sed 's/-t=//] shift continue} -b=* { global transformbasename := $[echo $1 | sed 's/-b=//] shift continue} * { if test x"$src" = x { global src := $1 } else { # this colon is to work around a 386BSD /bin/sh bug : global dst := $1 } shift continue} } } if test x"$src" = x { echo "install: no input file specified" exit 1 } else { true } if test x"$dir_arg" != x { global dst := $src global src := ''"" if test -d $dst { global instcmd := ':' } else { global instcmd := 'mkdir' } } else { # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test -f $src -o -d $src { true } else { echo "install: $src does not exist" exit 1 } if test x"$dst" = x { echo "install: no destination specified" exit 1 } else { true } # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if test -d $dst { global dst := ""$dst"/$[basename $src]" } else { true } } ## this sed command emulates the dirname command global dstdir := $[echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,] # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if test ! -d $dstdir { global defaultIFS := '' '' global IFS := $(IFS-${defaultIFS}) global oIFS := $(IFS) # Some sh's can't handle IFS=/ for some reason. global IFS := ''%'' set - $[echo $(dstdir) | sed -e 's@/@%@g' -e 's@^%@/@] global IFS := $(oIFS) global pathcomp := '''' while [ $# -ne 0 ] { global pathcomp := ""$(pathcomp)$(1)"" shift if test ! -d $(pathcomp) { $mkdirprog $(pathcomp) } else { true } global pathcomp := ""$(pathcomp)/"" } } if test x"$dir_arg" != x { $doit $instcmd $dst && if test x"$chowncmd" != x { $doit $chowncmd $dst; } else { true ; } && if test x"$chgrpcmd" != x { $doit $chgrpcmd $dst; } else { true ; } && if test x"$stripcmd" != x { $doit $stripcmd $dst; } else { true ; } && if test x"$chmodcmd" != x { $doit $chmodcmd $dst; } else { true ; } } else { # If we're going to rename the final executable, determine the name now. if test x"$transformarg" = x { global dstfile := $[basename $dst] } else { global dstfile := "$[basename $dst $transformbasename | sed $transformarg]$transformbasename" } # don't allow the sed command to completely eliminate the filename if test x"$dstfile" = x { global dstfile := $[basename $dst] } else { true } # Make a temp file name in the proper directory. global dsttmp := "$dstdir/#inst.$Pid#" # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f $(dsttmp)" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if test x"$chowncmd" != x { $doit $chowncmd $dsttmp; } else { true;} && if test x"$chgrpcmd" != x { $doit $chgrpcmd $dsttmp; } else { true;} && if test x"$stripcmd" != x { $doit $stripcmd $dsttmp; } else { true;} && if test x"$chmodcmd" != x { $doit $chmodcmd $dsttmp; } else { true;} && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile } && exit 0 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:doit) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [76 79] ) ) } spids: [74] ) ] spids: [74] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:mvprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(mv)}) spids: [90 94] ) ) } spids: [88] ) ] spids: [88] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cpprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(cp)}) spids: [99 103] ) ) } spids: [97] ) ] spids: [97] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chmodprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(chmod)}) spids: [108 112] ) ) } spids: [106] ) ] spids: [106] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chownprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(chown)}) spids: [117 121] ) ) } spids: [115] ) ] spids: [115] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chgrpprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(chgrp)}) spids: [126 130] ) ) } spids: [124] ) ] spids: [124] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stripprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(strip)}) spids: [135 139] ) ) } spids: [133] ) ] spids: [133] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:rmprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(rm)}) spids: [144 148] ) ) } spids: [142] ) ] spids: [142] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:mkdirprog) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(mkdir)}) spids: [153 157] ) ) } spids: [151] ) ] spids: [151] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:tranformbasename) op:Equal rhs:{(DQ )} spids:[161])] spids: [161] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:transform_arg) op:Equal rhs:{(DQ )} spids:[165])] spids: [165] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instcmd) op: Equal rhs: {(DQ ($ VSub_Name "$mvprog"))} spids: [169] ) ] spids: [169] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chmodcmd) op: Equal rhs: {(DQ ($ VSub_Name "$chmodprog") (" 0755"))} spids: [174] ) ] spids: [174] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:chowncmd) op:Equal rhs:{(DQ )} spids:[180])] spids: [180] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:chgrpcmd) op:Equal rhs:{(DQ )} spids:[184])] spids: [184] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:stripcmd) op:Equal rhs:{(DQ )} spids:[188])] spids: [188] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:rmcmd) op: Equal rhs: {(DQ ($ VSub_Name "$rmprog") (" -f"))} spids: [192] ) ] spids: [192] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:mvcmd) op: Equal rhs: {(DQ ($ VSub_Name "$mvprog"))} spids: [198] ) ] spids: [198] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:src) op:Equal rhs:{(DQ )} spids:[203])] spids: [203] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dst) op:Equal rhs:{(DQ )} spids:[207])] spids: [207] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dir_arg) op:Equal rhs:{(DQ )} spids:[211])] spids: [211] ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Number "$1"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] body: (DoGroup children: [ (Case to_match: {($ VSub_Number "$1")} arms: [ (case_arm pat_list: [{(-c)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instcmd) op: Equal rhs: {(DQ ($ VSub_Name "$cpprog"))} spids: [246] ) ] spids: [246] ) (C {(shift)}) (ControlFlow token:) ] spids: [243 244 256 -1] ) (case_arm pat_list: [{(-d)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dir_arg) op: Equal rhs: {(true)} spids: [263] ) ] spids: [263] ) (C {(shift)}) (ControlFlow token:) ] spids: [260 261 271 -1] ) (case_arm pat_list: [{(-m)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chmodcmd) op: Equal rhs: {(DQ ($ VSub_Name "$chmodprog") (" ") ($ VSub_Number "$2"))} spids: [278] ) ] spids: [278] ) (C {(shift)}) (C {(shift)}) (ControlFlow token:) ] spids: [275 276 293 -1] ) (case_arm pat_list: [{(-o)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chowncmd) op: Equal rhs: {(DQ ($ VSub_Name "$chownprog") (" ") ($ VSub_Number "$2"))} spids: [300] ) ] spids: [300] ) (C {(shift)}) (C {(shift)}) (ControlFlow token:) ] spids: [297 298 315 -1] ) (case_arm pat_list: [{(-g)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:chgrpcmd) op: Equal rhs: {(DQ ($ VSub_Name "$chgrpprog") (" ") ($ VSub_Number "$2"))} spids: [322] ) ] spids: [322] ) (C {(shift)}) (C {(shift)}) (ControlFlow token:) ] spids: [319 320 337 -1] ) (case_arm pat_list: [{(-s)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stripcmd) op: Equal rhs: {(DQ ($ VSub_Name "$stripprog"))} spids: [344] ) ] spids: [344] ) (C {(shift)}) (ControlFlow token:) ] spids: [341 342 354 -1] ) (case_arm pat_list: [{(-t) (Lit_Other "=") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:transformarg) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number "$1")}) (C {(sed)} {(SQ <"s/-t=//">)}) ] negated: False ) ] ) left_token: spids: [364 376] ) } spids: [363] ) ] spids: [363] ) (C {(shift)}) (ControlFlow token:) ] spids: [358 361 383 -1] ) (case_arm pat_list: [{(-b) (Lit_Other "=") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:transformbasename) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number "$1")}) (C {(sed)} {(SQ <"s/-b=//">)}) ] negated: False ) ] ) left_token: spids: [393 405] ) } spids: [392] ) ] spids: [392] ) (C {(shift)}) (ControlFlow token:) ] spids: [387 390 412 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$src"))} {(Lit_Other "=")} {(x)} {(Lit_Other "]")} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:src) op: Equal rhs: {($ VSub_Number "$1")} spids: [438] ) ] spids: [438] ) ] spids: [-1 435] ) ] else_action: [ (C {(Lit_Other ":")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dst) op: Equal rhs: {($ VSub_Number "$1")} spids: [452] ) ] spids: [452] ) ] spids: [442 456] ) (C {(shift)}) (ControlFlow token:) ] spids: [416 417 463 -1] ) ] spids: [236 240 466] ) ] spids: [233 468] ) ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$src"))} {(Lit_Other "=")} {(x)} {(Lit_Other "]")}) ] action: [(C {(echo)} {(DQ ("install:\tno input file specified"))}) (C {(exit)} {(1)})] spids: [-1 486] ) ] else_action: [(C {(true)})] spids: [500 505] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$dir_arg"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dst) op: Equal rhs: {($ VSub_Name "$src")} spids: [528] ) ] spids: [528] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:src) op:Equal rhs:{(DQ )} spids:[532])] spids: [532] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {($ VSub_Name "$dst")} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:instcmd) op: Equal rhs: {(Lit_Other ":")} spids: [553] ) ] spids: [553] ) ] spids: [-1 550] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:instcmd) op:Equal rhs:{(mkdir)} spids:[560])] spids: [560] ) ] spids: [557 564] ) ] spids: [-1 525] ) ] else_action: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(-f)} {($ VSub_Name "$src")} {(-o)} {(-d)} {($ VSub_Name "$src")} {(Lit_Other "]")} ) ] action: [(C {(true)})] spids: [-1 597] ) ] else_action: [ (C {(echo)} {(DQ ("install: ") ($ VSub_Name "$src") (" does not exist"))}) (C {(exit)} {(1)}) ] spids: [603 620] ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$dst"))} {(Lit_Other "=")} {(x)} {(Lit_Other "]")} ) ] action: [(C {(echo)} {(DQ ("install:\tno destination specified"))}) (C {(exit)} {(1)})] spids: [-1 641] ) ] else_action: [(C {(true)})] spids: [656 662] ) (If arms: [ (if_arm cond: [(C {(Lit_Other "[")} {(-d)} {($ VSub_Name "$dst")} {(Lit_Other "]")})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dst) op: Equal rhs: {(DQ ($ VSub_Name "$dst")) (/) (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$src")})] ) left_token: spids: [692 696] ) } spids: [687] ) ] spids: [687] ) ] spids: [-1 684] ) ] else_action: [(C {(true)})] spids: [699 705] ) ] spids: [566 707] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dstdir) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$dst")}) (C {(sed)} {(-e)} {(SQ <"s,[^/]*$,,;s,/$,,;s,^$,.,">)}) ] negated: False ) ] ) left_token: spids: [714 728] ) } spids: [713] ) ] spids: [713] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$dstdir"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:defaultIFS) op: Equal rhs: {(SQ <"\t\n">)} spids: [758] ) ] spids: [758] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_Hyphen arg_word: {(${ VSub_Name defaultIFS)} ) spids: [765 771] ) ) } spids: [763] ) ] spids: [763] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:oIFS) op: Equal rhs: {(DQ (${ VSub_Name IFS))} spids: [775] ) ] spids: [775] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:IFS) op:Equal rhs:{(SQ <"%">)} spids:[785])] spids: [785] ) (C {(set)} {(-)} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(${ VSub_Name dstdir)}) (C {(sed)} {(-e)} {(SQ <"s@/@%@g">)} {(-e)} {(SQ <"s@^%@/@">)}) ] negated: False ) ] ) left_token: spids: [794 816] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: {(DQ (${ VSub_Name oIFS))} spids: [818] ) ] spids: [818] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pathcomp) op:Equal rhs:{(SQ )} spids:[826])] spids: [826] ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Pound "$#")} {(-ne)} {(0)} {(Lit_Other "]")}) terminator: ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pathcomp) op: Equal rhs: {(DQ (${ VSub_Name pathcomp) (${ VSub_Number 1))} spids: [848] ) ] spids: [848] ) (C {(shift)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ (${ VSub_Name pathcomp))} {(Lit_Other "]")} ) terminator: ) ] action: [(C {($ VSub_Name "$mkdirprog")} {(DQ (${ VSub_Name pathcomp))})] spids: [-1 882] ) ] else_action: [(C {(true)})] spids: [894 900] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pathcomp) op: Equal rhs: {(DQ (${ VSub_Name pathcomp) (/))} spids: [904] ) ] spids: [904] ) ] spids: [845 912] ) ) ] spids: [-1 756] ) ] spids: [-1 914] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$dir_arg"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) ] action: [ (AndOr children: [ (C {($ VSub_Name "$doit")} {($ VSub_Name "$instcmd")} {($ VSub_Name "$dst")}) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chowncmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chowncmd")} {($ VSub_Name "$dst")} ) terminator: ) ] spids: [-1 963] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [972 978] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chgrpcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chgrpcmd")} {($ VSub_Name "$dst")} ) terminator: ) ] spids: [-1 1000] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1009 1015] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$stripcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$stripcmd")} {($ VSub_Name "$dst")} ) terminator: ) ] spids: [-1 1037] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1046 1052] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chmodcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chmodcmd")} {($ VSub_Name "$dst")} ) terminator: ) ] spids: [-1 1074] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1083 1089] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [-1 933] ) ] else_action: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$transformarg"))} {(Lit_Other "=")} {(x)} {(Lit_Other "]")} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dstfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$dst")})] ) left_token: spids: [1120 1124] ) } spids: [1119] ) ] spids: [1119] ) ] spids: [-1 1116] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dstfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(basename)} {($ VSub_Name "$dst")} {($ VSub_Name "$transformbasename")} ) (C {(sed)} {($ VSub_Name "$transformarg")}) ] negated: False ) ] ) left_token: spids: [1131 1145] ) ($ VSub_Name "$transformbasename") } spids: [1130] ) ] spids: [1130] ) ] spids: [1127 1149] ) (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$dstfile"))} {(Lit_Other "=")} {(x)} {(Lit_Other "]")} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dstfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$dst")})] ) left_token: spids: [1178 1182] ) } spids: [1177] ) ] spids: [1177] ) ] spids: [-1 1174] ) ] else_action: [(C {(true)})] spids: [1185 1191] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dsttmp) op: Equal rhs: {($ VSub_Name "$dstdir") (/) (Lit_Pound "#") (inst.) ($ VSub_Dollar "$$") (Lit_Pound "#") } spids: [1199] ) ] spids: [1199] ) (AndOr children: [ (C {($ VSub_Name "$doit")} {($ VSub_Name "$instcmd")} {($ VSub_Name "$src")} {($ VSub_Name "$dsttmp")} ) (AndOr children: [ (C {(trap)} {(DQ ("rm -f ") (${ VSub_Name dsttmp))} {(0)}) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chowncmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chowncmd")} {($ VSub_Name "$dsttmp")} ) terminator: ) ] spids: [-1 1271] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1280 1284] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chgrpcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chgrpcmd")} {($ VSub_Name "$dsttmp")} ) terminator: ) ] spids: [-1 1306] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1315 1319] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$stripcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$stripcmd")} {($ VSub_Name "$dsttmp")} ) terminator: ) ] spids: [-1 1341] ) ] else_action: [(Sentence child:(C {(true)}) terminator:)] spids: [1350 1354] ) (AndOr children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(x) (DQ ($ VSub_Name "$chmodcmd"))} {(KW_Bang "!") (Lit_Other "=")} {(x)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Sentence child: (C {($ VSub_Name "$doit")} {($ VSub_Name "$chmodcmd")} {($ VSub_Name "$dsttmp")} ) terminator: ) ] spids: [-1 1376] ) ] else_action: [ (Sentence child: (C {(true)}) terminator: ) ] spids: [1385 1389] ) (AndOr children: [ (C {($ VSub_Name "$doit")} {($ VSub_Name "$rmcmd")} {(-f)} {($ VSub_Name "$dstdir") (/) ($ VSub_Name "$dstfile")} ) (C {($ VSub_Name "$doit")} {($ VSub_Name "$mvcmd")} {($ VSub_Name "$dsttmp")} {($ VSub_Name "$dstdir") (/) ($ VSub_Name "$dstfile")} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [1091 1424] ) (C {(exit)} {(0)}) ] op_id: Op_DAmp ) ] )