���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home/ukubnwwtacc0unt/chapelbellstudios.com/uploads/cover/bin.tar
���ѧ٧ѧ�
add.modules 0000755 00000012260 15204035323 0006667 0 ustar 00 #! /bin/sh # # ADD.MODULES, Adds $ETC/*.modules to the $HOME/.login, .cshrc, .profile, # .bashrc & .kshenv # Copyright (C) 2000-2017 R.K. Owen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. ########################################################################## VERSION='$Id: 196cf1d4fbd7d3deecf648e85ee37ead75a60a93 $' SKEL=/etc/skel ETC=/skel /bin/cat <<! $0 adds a few lines to the beginning of your $HOME/.cshrc, $HOME/.login, $HOME/.profile, $HOME/.bashrc, and possibly your $HOME/.kshenv (or whatever is specified by the ENV environment variable). ! if [ -r $HOME/.bash_profile ]; then /bin/cat <<! Also your $HOME/.bash_profile will be processed. ! fi if [ -r $HOME/.bash_login ]; then /bin/cat <<! Also your $HOME/.bash_login will be processed. ! fi /bin/cat <<! The lines are prepended for sourcing the $ETC/csh.modules or $ETC/profile.modules files or to define the module alias or function. Why is it necessary? To ensure that you will have access to modules for all subshells, these lines need to be added to some of your 'dot' files. Your old .cshrc, .login, .profile, .bashrc and .kshenv will be renamed to .login.old, .cshrc.old, .profile.old, .bashrc.old and .kshenv.old respectively. So if you have any problems you will can easily restore them. This is version $VERSION . ! /bin/echo "Continue on (type n for no - default=yes)?\c" read xxx if [ x$xxx = xn ] then exit 1 fi # cleanse old dot file $1=file $2=clean temporary $3=file.old cleandot() { /bin/cat <<! Cleaning $1 ! mv $1 $3 sed \ -e "/^[ ]*if[ ]*([ ]*-e[ ].*\/csh\.modules[ ]*)[ ]*then[ ]*\$/,/^[ ]*endif[ ]*\$/d" \ -e "/^[ ]*if[ ]*\[[ ]*-[ef][ ].*\/profile\.modules[ ]*][ ]*\$/,/^[ ]*fi[ ]*\$/d" \ -e "/^[ ]*if[ ]*\[[ ]*-[ef][ ].*\/profile\.modules[ ]*].*then[ ]*\$/,/^[ ]*fi[ ]*\$/d" \ -e "/^[ ]*if[ ]*([ ]*\$?tcsh[ ]*)[ ]*then[ ]*\$/,/^[ ]*alias[ ]*module[ ]*.*\$/d" \ -e "/^[ ]*module().*[ ]*.*}[ ]*\$/d" \ -e "/^[ ]*case[ ]*\"\$0\"[ ]*in[ ]*\$/,/^[ ]*esac[ ]*\$/d" \ -e "/^[ ]*source[ ]*.*\/Modules.*\$/d" \ -e "/^[ ]*source[ ]*.*\/csh\.modules[ ]*/d" \ -e "/^[ ]*\.[ ]*.*\/profile\.modules[ ]*/d" \ $3 > $2 } # find if certain of the dot files have load lines already findload() { grep "^[ ]*module[ ]*load" $1 > /tmp/load.$$ } # put common stuff derivatives here $1=.dot_file $2=action $3=shell(csh,sh) $4=skel alternative shdot() { if [ -f $1 ] then /bin/cat <<! Processing your $1 (your old one is $1.old) ! if cleandot $1 /tmp/$1.$$ $1.old then if [ x$2 = xsource ] then /bin/cat <<! Adding sourcing lines at beginning of $1 ! if [ x$3 = xsh ] then findload $1.old /bin/cat > $1 <<! if [ -f $ETC/profile.modules ] then . $ETC/profile.modules # put your own module loads here ! if [ -s /tmp/load.$$ ] then /bin/cat /tmp/load.$$ >> $1 else /bin/cat >> $1 <<! module load null ! fi /bin/cat >> $1 <<! fi ! elif [ x$3 = xcsh ] then findload $1.old /bin/cat > $1 <<! if ( -e $ETC/csh.modules ) then source $ETC/csh.modules # put your own module loads here ! if [ -s /tmp/load.$$ ] then /bin/cat /tmp/load.$$ >> $1 else /bin/cat >> $1 <<! module load null ! fi /bin/cat >> $1 <<! endif ! fi /bin/cat /tmp/$1.$$ >> $1 && /bin/rm /tmp/$1.$$ elif [ x$2 = xalias ] then /bin/cat <<! Adding alias or function lines at beginning of $1 ! if [ x$3 = xsh ] then /bin/cat > $1 <<! case "\$0" in -sh|sh|*/sh) modules_shell=sh ;; -ksh|ksh|*/ksh) modules_shell=ksh ;; -zsh|zsh|*/zsh) modules_shell=zsh ;; -bash|bash|*/bash) modules_shell=bash ;; esac module() { eval \`/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl \$modules_shell \$*\`; } ! elif [ x$3 = xcsh ] then /bin/cat > $1 <<! if (\$?tcsh) then set modules_shell="tcsh" else set modules_shell="csh" endif alias module 'eval \`/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl '\$modules_shell '\!*\`' ! fi /bin/cat /tmp/$1.$$ >> $1 && /bin/rm /tmp/$1.$$ fi else /bin/echo "Had problems with your $1" fi else /bin/cat <<! You had no $1 as I see it. Copying $4 for you. ! /bin/cp $4 $1 fi /bin/rm /tmp/load.$$ 2> /dev/null } # process files in $HOME cd $HOME if [ -r .bash_profile ]; then shdot .bash_profile source sh $SKEL/.profile fi if [ -r .bash_login ]; then shdot .bash_login source sh $SKEL/.profile fi shdot .profile source sh $SKEL/.profile shdot .bashrc alias sh $SKEL/.kshenv shdot `basename ${ENV:=.kshenv}` alias sh $SKEL/.kshenv shdot .login source csh $SKEL/.login shdot .cshrc alias csh $SKEL/.cshrc exit mkroot 0000755 00000005504 15204035323 0006006 0 ustar 00 #! /bin/sh # # MKROOT, Makes all the usual ./bin, ./sbin, ./etc, ./lib, ./include, # ./info and BSD-style ./man/* directories # Copyright (C) 2000-2017 R.K. Owen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. ########################################################################## PERMS=755 usage() { cat <<EOF $0 makes all the usual ./bin, ./sbin, ./etc, ./lib, ./include, ./info and BSD-style ./man/\* directories if the first option is "-c" it will clean out any empty directories of same. It also sets the permissions to $PERMS on the directories unless overridden by the -p option. usage: $0 [-p|--perms XXX] [-m|--make] [-c|--clean] -p XXX permissions for directories in chmod suitable format -m make directories in the current directory -c clean out empty directories Note common man directory conventions '1' - user commands '3' - library functions '5' - file formats and conventions '7' - macro packages and conventions '8' - administrative commands 'l' - local commands by R.K.Owen,Ph.D. version 'Revision: 1.1.1.1.28.1 $ Date: 2010/11/11 18:23:18 $' EOF } if [ $# -eq 0 ] then usage exit 1 fi while [ $# -gt 0 ] do case $1 in -p|-perms|--p|--perms) shift PERMS=$1 shift continue ;; -c|-clean|--c|--clean) if [ ! -s ./man/whatis ]; then rm ./man/whatis else echo ./man/whatis is not empty fi for m in 1 2 3 4 5 6 7 8 n p l do if [ -d ./man/man$m ]; then if [ `ls ./man/man$m|wc -l` -eq 0 ]; then rmdir ./man/man$m if [ -d ./man/cat$m ]; then if [ `ls ./man/cat$m|wc -l` -eq 0 ]; then rmdir ./man/cat$m else echo ./man/cat$m is not empty fi;fi else echo ./man/man$m is not empty fi;fi done for d in bin sbin etc lib include info man do if [ -d ./$d ]; then if [ `ls ./$d|wc -l` -eq 0 ]; then rmdir ./$d else echo ./$d is not empty fi;fi done exit ;; -m|-make|--m|--make) for d in bin sbin etc lib include info man do mkdir ./$d ; chmod $PERMS ./$d done touch ./man/whatis ; chmod $PERMS ./man/whatis for m in 1 2 3 4 5 6 7 8 n p l do mkdir ./man/man$m ; chmod $PERMS ./man/man$m mkdir ./man/cat$m ; chmod $PERMS ./man/cat$m done exit ;; *) usage exit 2 ;; esac done exit createmodule.py 0000755 00000020261 15204035323 0007570 0 ustar 00 #!/usr/libexec/platform-python # # createmodule.py - Takes the name of a environment init script and # produces a modulefile that duplicates the changes made by the init script # # Copyright (C) 2012 by Orion E. Poplawski <orion@cora.nwra.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import print_function from optparse import OptionParser import os,sys,re from subprocess import * import platform # Handle options usage = "Usage: %prog [-p prefix] <initscript> [args]" parser = OptionParser() parser.set_usage(usage) parser.add_option('-p', '--prefix', action='store', type='string', dest='prefix', help='Specify path prefix') parser.add_option('--noprefix', action='store_true', dest='noprefix', default=False, help='Do not generate a prefix') (options, args) = parser.parse_args() # Need a script name if not args: parser.print_usage() exit(1) # Determine if running environment is based on cmd.exe or not def iscmdshell(): return True if platform.system() == 'Windows' else False # Return environment after a command def getenv(cmd = ':'): env = {} if iscmdshell(): # ':' command not supported by cmd.exe cmd = (cmd if cmd != ':' else '@echo off') + " >nul & set" else: cmd = cmd + " >/dev/null;env" p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True) (stdout, stderr) = p.communicate() if p.returncode != 0: print("ERROR: Could not execute initscript:") print("%s returned exit code %d" % (cmd, p.returncode)) print(stderr) exit(1) if stderr != '': print("WARNING: initscript sent the following to stderr:") print(stderr) # Parse the output key=value pairs skip = False for line in stdout.splitlines(): if skip: if line == '}': skip = False continue elif iscmdshell() and line.find('=') == -1: continue try: (var,value) = line.split('=',1) except ValueError: print("ERROR: Could not parse output line:") print(line) exit(1) # Exported functions - not handled if value.find('() {') == 0: skip = True else: env[var] = value return env #Record initial environment env1=getenv() #Record environment after sourcing the initscript if iscmdshell(): if len(args)>1: env2=getenv('"' + args[0] + '" ' + " ".join(args[1:])) else: env2=getenv('"' + args[0] + '"') else: env2=getenv(". " + " ".join(args)) # Initialize our variables for storing modifications chdir = None appendpath = {} prependpath = {} unhandled = {} setenv = {} unsetenv = [] pathnames = [] # Function to nomalize all paths in a list of paths and remove duplicate items def normpaths(paths): newpaths = [] for path in paths: normpath = os.path.normpath(path) if normpath not in newpaths and normpath != '.': newpaths.append(os.path.normpath(path)) return newpaths # Start with existing keys and look for changes for key in env1.keys(): # Test for delete if key not in env2: unsetenv.append(key) continue # No change if env1[key] == env2[key]: del env2[key] continue #Working directory change if key == 'PWD': chdir=os.path.normpath(env2[key]) pathnames.append(chdir) del env2[key] continue # Determine modifcations to beginning and end of the string try: (prepend,append) = env2[key].split(env1[key]) except ValueError: continue if prepend: presep = prepend[-1:] prependpaths = prepend.strip(presep).split(presep) # LICENSE variables often include paths outside install directory if 'LICENSE' not in key: pathnames += prependpaths if presep not in prependpath: prependpath[presep] = {} newpath = presep.join(normpaths(prependpaths)) if newpath: prependpath[presep][key] = newpath else: unhandled[key] = env2[key] if append: appsep = append[0:1] appendpaths = append.strip(appsep).split(appsep) # LICENSE variables often include paths outside install directory if 'LICENSE' not in key: pathnames += appendpaths if appsep not in appendpath: appendpath[appsep] = {} newpath = appsep.join(normpaths(appendpaths)) if newpath: appendpath[appsep][key] = newpath else: unhandled[key] = env2[key] del env2[key] # We're left with new keys in env2 for key in env2.keys(): # Use prepend-path for new paths if (re.search('(DIRS|FILES|PATH)$',key)) or (':' in env2[key]): prependpaths = env2[key].strip(':').split(':') # MANPATH can have system defaults added it it wasn't previously set # LICENSE variables often include paths outside install directory if key != 'MANPATH' and 'LICENSE' not in key: pathnames += prependpaths if ':' not in prependpath: prependpath[':'] = {} prependpath[':'][key] = ':'.join(normpaths(prependpaths)) continue # Set new variables setenv[key] = os.path.normpath(env2[key]) if 'LICENSE' not in key: pathnames.append(setenv[key]) # Report unhandled keys for key in unhandled.keys(): print("Unhandled change of", key, file=sys.stderr) print("Before <%s>" % env1[key], file=sys.stderr) print("After <%s>" % unhandled[key], file=sys.stderr) for sepkey in appendpath.keys(): appendpath[sepkey].pop(key, None) for sepkey in prependpath.keys(): prependpath[sepkey].pop(key, None) # Determine a prefix prefix=None if options.prefix: prefix = options.prefix elif not options.noprefix: prefix = os.path.commonprefix(pathnames).rstrip('/') if prefix == '': prefix = None # Print out the modulefile print("#%Module 1.0") # Prefix if prefix is not None: print("\nset prefix " + prefix + "\n") # Chdir if chdir is not None: print("chdir\t" + chdir) # Function to format output line with tabs and substituting prefix def formatline(item, key, value=None): print(item, end=' ') print("\t"*(2-(len(item)+1)//8), end=' ') print(key, end=' ') if value is not None: print("\t"*(3-(len(key)+1)//8), end=' ') if prefix is not None: # Prefer usage of regular expression to perform a none # case-sensitive substitution (cygwin vs cmd.exe) if iscmdshell(): print(re.sub('(?i)' + re.escape(prefix), '$prefix', value)) else: print(value.replace(prefix,'$prefix')) else: print(value) # Paths first, grouped by variable name for sepkey in prependpath.keys(): pathkeys = list(prependpath[sepkey].keys()) pathkeys.sort() for key in pathkeys: if sepkey == ":": formatline("prepend-path",key,prependpath[sepkey][key]) else: formatline("prepend-path --delim %s" % sepkey,key,prependpath[sepkey][key]) for sepkey in appendpath.keys(): pathkeys = list(appendpath[sepkey].keys()) pathkeys.sort() for key in pathkeys: if sepkey == ":": formatline("append-path",key,appendpath[sepkey][key]) else: formatline("append-path --delim %s" % sepkey,key,appendpath[sepkey][key]) # Setenv setenvkeys = list(setenv.keys()) setenvkeys.sort() if setenvkeys: print() for key in setenvkeys: formatline("setenv",key,setenv[key]) # Unsetenv unsetenv.sort() if unsetenv: print() for key in unsetenv: formatline("unsetenv",key) createmodule.sh 0000755 00000013213 15204035323 0007551 0 ustar 00 #!/bin/bash # # createmodule.sh - Takes the name of a environment init script and # produces a modulefile that duplicates the changes made by the init script # # Copyright (C) 2010-2012 by Orion E. Poplawski <orion@cora.nwra.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. usage="Usage: $0 [-p prefix] <initscript> [args]" usage() { echo $usage 1>&2 exit 1 } while getopts "p:" opt do case $opt in p) prefix=$OPTARG; shift 2;; *) usage;; esac done # Need a script name [ -z "$1" ] && usage # Need to be a readable script if [ ! -r "$1" ] then echo "ERROR: Cannot read $1" 1>&2 exit 1 fi #Will print out array assignment list printenvarray () { local skip=0 env | while read x do # start of function definition: skip full definition if [[ "$x" =~ '() {' ]]; then skip=1 fi if [ $skip -eq 0 ]; then key=${x%%=*} value=`printenv "$key"` if [ $? -eq 0 ] then echo [$key]="'$value'" fi fi # end of function definition if [ "$x" = '}' ]; then skip=0 fi done } #Apparently we need to declare the associative arrays declare -A env1 env2 #Record starting environment eval env1=(`printenvarray`) #Source the environment script . "$@" >/dev/null #Record ending environment eval env2=(`printenvarray`) #Print out the modulefile echo "#%Module 1.0" #Prefix [ -n "$prefix" ] && echo -e "\nset prefix $prefix\n" # dedup - remove duplicate entries from a list #Subshell so we can sort the output ( dedup() { list=`mktemp` [ -n "$2" ] && sep=$2 || sep=: echo $1 | sed -r -e 's,[^/]+/\.\./,,g' -e 's,[^/]+/\.\./,,g' -e "s/\\$sep/\n/g" | while read x do grep -q -Fx ${x} $list && continue if [ -n "$prefix" ] then echo $x | sed -e s,$prefix,\$prefix, else echo $x fi echo $x >> $list done | tr '\n' $sep | sed -e "s/\\$sep\$//" rm $list } #Keys that changed for key in "${!env1[@]}" do if [ "${env1[$key]}" != "${env2[$key]}" ] then #Working directory change if [ "$key" = PWD ] then if [ -n "$prefix" ] then echo -e "chdir\t\t${env2[PWD]}" | sed -e s,$prefix,\$prefix,g else echo -e "chdir\t\t${env2[PWD]}" fi #Test for delete elif [ -z "${env2[$key]}" ] then echo -e "unsetenv\t${key}\t${env2[$key]}" #Test for prepend elif [ "${env2[$key]%${env1[$key]}}" != "${env2[$key]}" ] then added=${env2[$key]%${env1[$key]}} sep=${added: -1} added=${added%$sep} added=$(dedup $added $sep) if [ $sep = : ] then echo -e "prepend-path\t$key\t${added}" else echo -e "prepend-path\t--delim $sep\t$key\t${added}" fi #Test for prepend plus : added at end (MANPATH) elif [ "${key: -4}" = PATH -a "${env2[$key]%${env1[$key]}:}" != "${env2[$key]}" ] then added=$(dedup ${env2[$key]%${env1[$key]}:}) echo -e "prepend-path\t$key\t${added}" #Test for append elif [ "${env2[$key]#${env1[$key]}}" != "${env2[$key]}" ] then added=${env2[$key]#${env1[$key]}} sep=${added:0:1} added=${added#$sep} added=$(dedup $added $sep) if [ $sep = : ] then echo -e "append-path\t$key\t${added}" else echo -e "append-path\t--delim $sep\t$key\t${added}" fi #Test for prepend plus append elif [ "${env2[$key]%${env1[$key]}*}" != "${env2[$key]}" ] then prepended=${env2[$key]%${env1[$key]}*} presep=${prepended: -1} prepended=${prepended%$presep} prepended=$(dedup $prepended $presep) appended=${env2[$key]#*${env1[$key]}} appsep=${appended:0:1} appended=${appended#$appsep} appended=$(dedup $appended $appsep) if [ $presep != $appsep -o -z "$prepended" -o -z "$appended" ] then #Unhandled echo "Unhandled change of $key" 1>&2 echo "Before <${env1[$key]}>" 1>&2 echo "After <${env2[$key]}>" 1>&2 else if [ $presep = : ] then echo -e "prepend-path\t$key\t${prepended}" echo -e "append-path\t$key\t${appended}" else echo -e "prepend-path\t--delim $presep\t$key\t${prepended}" echo -e "append-path\t--delim $appsep\t$key\t${appended}" fi fi else if [ -n "$prefix" ] then echo -e "setenv\t\t${key}\t${env2[$key]}" | sed -e s,$prefix,\$prefix,g else echo -e "setenv\t\t${key}\t${env2[$key]}" fi fi fi #Delete keys we have handled unset env1[$key] unset env2[$key] done #New keys for key in "${!env2[@]}" do if [ "$key" = OLDPWD ] then continue fi #Use prepend-path for new paths if [ "${key: -4}" = PATH -o "${key: -4}" = DIRS -o "${key: -4}" = FILES ] then # TODO - Need to handle stripping of default MANPATH echo -e "prepend-path\t${key}\t"$(dedup ${env2[$key]}) else if [ -n "$prefix" ] then echo -e "setenv\t\t${key}\t${env2[$key]}" | sed -e s,$prefix,\$prefix,g else echo -e "setenv\t\t${key}\t${env2[$key]}" fi fi done ) | sort # vim:set tabstop=2 shiftwidth=2 expandtab autoindent:
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�