File: save-file

package info (click to toggle)
scsitools 0.12-3
  • links: PTS
  • area: main
  • in suites: buster
  • size: 1,244 kB
  • sloc: ansic: 6,043; tcl: 2,144; sh: 923; makefile: 100
file content (49 lines) | stat: -rwxr-xr-x 1,793 bytes parent folder | download | duplicates (12)
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
#!/usr/bin/wish -f

set sdevice $argv

frame .win
frame .win.h
label .win.h.l -bitmap questhead -background pink
message .win.h.m -aspect 400 -background pink -justify center -text \
{Save the selected values from the target into a disk file. \
 The file is executable. Just execute it with /bin/sh to make these \
 settings the current settings. Then you can decide to store them in the NVRAM \
 of the target device with scsiinfo or scsi-config.}

pack .win.h.l .win.h.m -side left -padx 5 
pack .win.h -side top -pady 20 -padx 20

frame .win.fname
label .win.fname.label -text "Filename:"
text .win.fname.text -background white -height 1 -width 40 -relief sunken -borderwidth 2
pack .win.fname.label .win.fname.text -side left -padx 1
pack .win.fname -side top -padx 20 -pady 10

set base [exec basename $sdevice]

.win.fname.text delete 1.0 end
.win.fname.text insert end "/var/run/scsi-config.$base"

frame .win.f
radiobutton .win.cur -text "Current values" -width 20 -variable flag -value "-LXR" -anchor w
radiobutton .win.sav -text "Saved values" -width 20 -variable flag -value "-LXRS" -anchor w
radiobutton .win.man -text "Factory defaults" -width 20 -variable flag -value "-LXRM" -anchor w
pack .win.cur .win.sav .win.man  -padx 3
.win.cur select

button .win.f.quit -width 10 -text "Quit" -command exit \
	-activebackground red -activeforeground white
button .win.f.continue -width 10 -text "Save" \
	-activebackground green \
	-command {global fname; set fname [.win.fname.text get 1.0 "end -1 chars"]; destroy .win}
pack .win.f.continue .win.f.quit -side left -padx 30 -ipadx 2 -ipady 2
pack .win.f -pady 10
pack .win
tkwait window .win

# This should do it.  Do not come and complain to me if this
# does not work
exec scsiinfo $flag $sdevice > $fname
exec chmod 700 $fname
exit