⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 permissn.tcl

📁 vxworks下MV5500的BSP支持包。是支持tornad221下的版本。
💻 TCL
📖 第 1 页 / 共 2 页
字号:
                catch {exec /bin/chmod o+w $windBase/.wind}    } else {        catch {exec /bin/chmod o-w $windBase}                catch {exec /bin/chmod o-w $windBase/.wind}    }    if { [isGUImode] } {        endWaitCursor    }    return 1}################################################################################ umaskGet - getting the user umask value## This routine gets the current umask setting, converts it to file permision# format.## SYNOPSIS# umaskGet## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc umaskGet {} {    global setupVals    set setupVals(umask) [split [setupUmaskSet [format "%d" 022]] ""]    setupUmaskSet $setupVals(umask)    #initialize all to 0    set setupVals(ur) 0    set setupVals(uw) 0    set setupVals(gr) 0    set setupVals(gw) 0    set setupVals(or) 0    set setupVals(ow) 0    set noRead {7 6 5 4}    set noWrite {7 6 3 2}    set user [lindex $setupVals(umask) 1]    if {[lsearch $noRead $user] == "-1"}  { set setupVals(ur) 1 }    if {[lsearch $noWrite $user] == "-1"} { set setupVals(uw) 1 }    set group [lindex $setupVals(umask) 2]    if {[lsearch $noRead $group] == "-1"}  { set setupVals(gr) 1 }    if {[lsearch $noWrite $group] == "-1"} { set setupVals(gw) 1 }    set other [lindex $setupVals(umask) 3]    if {[lsearch $noRead $other] == "-1"}  { set setupVals(or) 1 }    if {[lsearch $noWrite $other] == "-1"} { set setupVals(ow) 1 }}################################################################################ umaskSet - sets new umask value## This routine gets the user file permision request, converts it to a umask# value then set it for the current process.  A global variable fileMode is# also created in 'chmod' flag syntax for later use.## SYNOPSIS# umaskSet## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc umaskSet {} {    global setupVals    set user  [expr 6 - ( $setupVals(ur)*4 + $setupVals(uw)*2 )]    set group [expr 6 - ( $setupVals(gr)*4 + $setupVals(gw)*2 )]    set other [expr 6 - ( $setupVals(or)*4 + $setupVals(ow)*2 )]    setupUmaskSet [format "%d" 0$user$group$other]    set plus "+"    set minus "-"    set setupVals(fileMode) [format "u%sr,u%sw,g%sr,g%sw,o%sr,o%sw" \                            [expr $setupVals(ur) == 1 ? \$plus:\$minus] \                            [expr $setupVals(uw) == 1 ? \$plus:\$minus] \                            [expr $setupVals(gr) == 1 ? \$plus:\$minus] \                            [expr $setupVals(gw) == 1 ? \$plus:\$minus] \                            [expr $setupVals(or) == 1 ? \$plus:\$minus] \                            [expr $setupVals(ow) == 1 ? \$plus:\$minus]]}################################################################################ setExecutePermissions - sets the execute permissions of a file.## This routine sets the "group" and "other" execute permissions of a file,# based on the "execute" checkbox settings the user has selected on the# File Permissions page for Unix.  Execute permissions are only changed if# the file originally has been set for "user" execute.## SYNOPSIS:# setExecutePermissions <filename>## PARAMETERS:# <filename># The file whose execute permissions are to be changed.## RETURNS: N/A## ERRORS: N/A#proc setExecutePermissions {filename} {    global setupVals    # first make sure the filename exists and it is actually a file.    if { [file exists $filename] && [file isfile $filename] } {        set permissions [file attributes $filename -permissions]        set userPerm [string index $permissions 2]        set groupPerm [string index $permissions 3]        set otherPerm [string index $permissions 4]        # change execute permissions if the file is actually        # an executable file, i.e. user executable permissions        # have originally been set.        if {[expr $userPerm % 2] != 0} {            # change group permissions to executable, if the "group            # executable" checkbox was checked in the Permissions            # page, and if the file was not already set to be group            # executable.            if {$setupVals(gx) == 1 && [expr $groupPerm % 2] == 0} {                set groupPerm [incr groupPerm]            } elseif {$setupVals(gx) == 0 && \                      [expr $groupPerm % 2] != 0} {                # change group permissions to be NOT executable, if the                # group executable checkbox was NOT checked, but the file                # was already set to be group executable.                set groupPerm [expr $groupPerm - 1]            }            # change other permissions to executable, if the "other            # executable" checkbox was checked in the Permissions page,            # and if the file was not already set to be other executable.            if {$setupVals(ox) == 1 && [expr $otherPerm % 2] == 0} {                set otherPerm [incr otherPerm]            } elseif {$setupVals(ox) == 0 && \                      [expr $otherPerm % 2] != 0} {                # change other permissions to be NOT executable, if the                # other executable checkbox was NOT checked, but the file                # was already set to be other executable.                set otherPerm [expr $otherPerm - 1]            }            # finally change permissions on the file.            set newpermissions "00$userPerm$groupPerm$otherPerm"            catch {file attributes $filename -permissions $newpermissions}        }    }}################################################################################ changePermission - this procedure toggles permissions## This procedure toggles permissions## SYNOPSIS:# .tS# changePermission# .tE## PARAMETERS:# idList - list of permission id's which need to be switch## RETURNS: N/A## ERRORS: N/A#proc changePermission {idList} {    global setupVals    global perVals     set count 1    foreach per "gr gw or ow"  {        set perList($count) $per        incr count    }     foreach id $idList {        if {[array size perList] < $id || $id == 0} {            puts "Error: [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]"            while { [prompt "Press <Return> to continue."] != "" } {            }            return 0        }     }    foreach id $idList {        flipPermission $perList($id)     }    return 1}################################################################################ createString - creates a string of repeated characters## This procedure creates a string of repeated characters.## SYNOPSIS:# .tS# createString# .tE## PARAMETERS:# char - character to be repeated in the string# length - length of resulting string## RETURNS:# str - string of repeated characters## ERRORS: N/A#proc createString {char length} {    set i 0    set str ""    while {$i < $length} {        append str $char        incr i    }    return $str}################################################################################ flipPermission - toggles permission values## This procedure toggles permission values in setupVals and changes the output # to be displayed in perVals.## SYNOPSIS:# .tS# flipPermission# .tE## PARAMETERS:# bit - permission which should be changed (ie: gr, gw, or, ow)## RETURNS: N/A## ERRORS: N/A#proc flipPermission {bit} {    global setupVals     global perVals     if { $setupVals($bit) == "0" } {        set setupVals($bit) 1        set perVals($bit) "x"    } {        set setupVals($bit) 0        set perVals($bit) ""    }}####################################################################### Dialog Text Messages######################################################################set strTable(PERMISSION_TITLE) "Permission Settings"set strTable(PERMISSION_MSG_1) \    "SETUP is about to install the component(s) you have requested.\     \n\nThe selected button(s) below indicate the file permissions which\     will be set during the installation process.\     \n\nPlease adjust these to suit your site requirements."

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -