File: fileDir.template

package info (click to toggle)
dotfile 1%3A2.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,472 kB
  • ctags: 523
  • sloc: tcl: 14,072; sh: 918; makefile: 177; lisp: 18; ansic: 7
file content (167 lines) | stat: -rw-r--r-- 6,219 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
### Copyright (C) 1996 Per Zacho
### 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, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc fileDir {} {
    # System<->Bash interface / File and directory handling

    Desc "This configuration page will help you to setup how Bash is to create files and"\
    "directories, handle links, etc."

    ShortDesc "File/directory handling"

    ### File/directory creation ###

    Header head1 -text "File/directory creation"\
	    -background gray\
	    -help "Setup on how files and directories are created."

    CheckBox noclobber -text "Allow redirected output overwriting existing files"\
	    -default 1\
	    -help "When redirecting output (with >, >& and <>), you can make sure existing files"\
	    "will not be overwritten. That is, you can still use >! to force an overwriting."

    Line line1

    ###

    Label userLabel -text "User"\
	    -help "File/dir permissions for user (creator)."\
	    -height 2

    Label groupLabel -text "Group"\
	    -help "File/dir permission for persons in the same \"group\" as you."\
	    -height 2

    Label otherLabel -text "Other"\
	    -help "File/dir permission for other persons (i.e. persons not in the same group"\
	    "as you)."\
	    -height 2

    array set readList {User 1 Group 1 Other 1}
    array set writeList {User 1 Group 0 Other 0}
    array set executeList {User 1 Group 1 Other 1}

    foreach elm {User Group Other} {
	CheckBox read$elm -text "Read file\nRead dir"\
		-help "When checked, persons (user, group or others) are allowed to read"\
		"your files/directories."\
		-default $readList($elm)

	CheckBox write$elm -text "Write file\nWrite in dir"\
		-help "When checked, persons (user, group or others) are allowed to"\
		"(over)write files or for directories, allowed to create files."\
		-default $writeList($elm)

	CheckBox execute$elm -text "\ncd to dir"\
		-help "When checked, persons (user, group or others) are allowd to \"change"\
		"dir\" to your directory. This option has no influence on files--you cannot"\
		"create files with execute permission."\
		-default $executeList($elm)
    }

    Frame label -text ""\
	    -entries {userLabel groupLabel otherLabel}\
	    -orient top
    Frame read -text ""\
	    -entries {readUser readGroup readOther}\
	    -orient top
    Frame write -text ""\
	    -entries {writeUser writeGroup writeOther}\
	    -orient top
    Frame execute -text ""\
	    -entries {executeUser executeGroup executeOther}\
	    -orient top

    Frame umask -text ""\
	    -entries {label read write execute}


    ### Directory options ###

    Header head2 -text "Directory options"\
	    -background gray\
	    -help "Setup of how to handle directory links and variables."

    Radio links -text "How is Bash to follow directory links?"\
	    -entryhelp {"logically" "Follow the link, but use link name as directory name."\
	    "physically"\
	    "Follow the link, but change the current working directory to the physical path."}\
	    -help "This option influence on how Bash will set current working directory. If set"\
	    "to physical, \"cd\"-ing a symbolic directory link and then returning via \"cd ..\""\
	    "might not return you to where you started--which you are insured if you choose"\
	    "following links logically."\
	    -packFrame:fill x

    Line line2

    CheckBox cdvars -text "\"cd\" allow variables as argument"\
	    -help "\"cd\" will usually try to find the subdir specified (if set, by searching"\
	    "through the CDPATH). If failing this, return unsuccessfully. But if this option"\
	    "is checked another task is included before failing--\"cd\" will check to see"\
	    "if a variable is specified with a similar name as the argument, and that variable"\
	    "contains a valid directory path.\nUsing normal variable expansion (prefix \$)"\
	    "will give the same result, even if the option is not checked. The main difference"\
	    "is \"cd\" is able to expand and check the variable contains for a valid directory"\
	    "structure, before executing--and that without prefix a \$ to the variable."

    CheckBox cdspell -text "\"cd\" guess directory name if misspelled"\
	    -help "If set, minor errors in the spelling of a directory component in a cd command"\
	    "will be corrected. The errors checked for are transposed characters, a missing"\
	    "character, and one character too many. If a correction is found, the corrected"\
	    "file name is printed, and the command proceeds. This option is enabled by default,"\
	    "but is only used by interactive shells. (This option is available in Bash version"\
	    "2.0 only)"\
	    -default 1

    ShowPage {
	if {[set version@bash(index)]} {
	    Enable cdspell
	} {
	    Disable cdspell
	}
    }

    Save {
	### File/directory creation ###
	if {$noclobber == 0 || $generateDefault} {
	    print "set [pick $noclobber + -]o noclobber"
	}

	foreach elm {User Group Other} {
	    set $elm [expr (![set read$elm])*4 + (![set write$elm])*2 + ![set execute$elm]]
	}
	set permission "$User$Group$Other"
	if {$permission != "022" || $generateDefault} {
	    print "umask $permission"
	}

	### Directory options ###
	if {$links(index) || $generateDefault} {
	    print "set [pick $links(index) - +]o physical"
	}

	if {$cdvars || $generateDefault} {
	    if [set version@bash(index)] {
		print "shopt -[pick $cdvars s u] cdable_vars"
	    } {
		print "[pick $cdvars "export cdable_vars=on" "unset cdable_vars"]"
	    }
	}

	if {($cdspell != 1 || $generateDefault) && [set version@bash(index)]} {
	    print "shopt -[pick $cdspell s u] cdspell"
	}
    }
}