3 # dnetsetup version 1.0
4 # Copyright (c)1998 by Art Cancro / All rights reserved.
5 # This program is distributed under the terms of the GNU General Public
6 # License. See copyright.txt for more information.
8 # dnetsetup requires Savio Lam's "dialog" program to perform its interactive
9 # dialogs. This program is standard on most Linux systems, and should be
10 # easy enough to get on other systems.
13 rm -f $tempfile $tempfile2 $menucmd 2>/dev/null
21 ./netsetup roomlist $1 >$tempfile 2>&1
22 $DIALOG --textbox $tempfile $menuheight $menuwidth
29 ./netsetup roomlist $node >$tempfile
30 numrooms=`cat $tempfile |wc -l`
31 sed s/\ /\\\\\ /g <$tempfile | sed s/$/\ \"\"/g >$tempfile2
32 echo $DIALOG --menu \"Select the room you wish to stop sharing\" \
33 $menuheight $menuwidth $numrooms \
34 `cat $tempfile2` >$menucmd
35 if sh $menucmd 2>$tempfile; then
36 room_to_delete=`cat $tempfile`
38 if $DIALOG --yesno "Are you sure you wish to stop sharing $room_to_delete ?" 5 $menuwidth ; then
39 if ./netsetup unshare $node "$room_to_delete" 2>$tempfile; then
40 $DIALOG --msgbox "$room_to_delete has been unshared." 5 $menuwidth
42 $DIALOG --textbox $tempfile $menuheight $menuwidth
52 if $DIALOG --inputbox "Enter name of room to share:" \
53 $menuheight $menuwidth 2>$tempfile ; then
55 room_to_share=`cat $tempfile`
56 if ./netsetup share $node "$room_to_share" 2>$tempfile; then
57 $DIALOG --msgbox "$room_to_share has been added." 5 $menuwidth
59 $DIALOG --textbox $tempfile $menuheight $menuwidth
70 while [ $choice != EXIT ]
72 if $DIALOG --menu "Editing $node" $menuheight $menuwidth 4 \
73 LIST "List currently shared rooms" \
74 SHARE "Add a shared room" \
75 UNSHARE "Stop sharing a room" \
76 EXIT "Return to main menu" 2>$tempfile; then
77 choice=`cat $tempfile`
82 [ $choice = "LIST" ] && roomlist $node
83 [ $choice = "SHARE" ] && do_share $node
84 [ $choice = "UNSHARE" ] && unshare $node
92 ./netsetup nodelist >$tempfile
93 numnodes=`cat $tempfile |wc -l`
94 sed s/$/\ \"\"/g <$tempfile >$tempfile2
95 echo $DIALOG --menu \"Select the node you wish to edit\" \
96 $menuheight $menuwidth $numnodes \
97 `cat $tempfile2` >$menucmd
98 if sh $menucmd 2>$tempfile; then
99 system_to_edit=`cat $tempfile`
100 edit_this_node $system_to_edit
111 delete_network_nodes() {
113 ./netsetup nodelist >$tempfile
114 numnodes=`cat $tempfile |wc -l`
115 sed s/$/\ \"\"/g <$tempfile >$tempfile2
116 echo $DIALOG --menu \"Select the node you wish to delete\" \
117 $menuheight $menuwidth $numnodes \
118 `cat $tempfile2` >$menucmd
119 if sh $menucmd 2>$tempfile; then
120 system_to_delete=`cat $tempfile`
122 if $DIALOG --yesno "Are you sure you wish to delete $system_to_delete ?" 5 $menuwidth ; then
123 if ./netsetup deletenode $system_to_delete 2>$tempfile; then
124 $DIALOG --msgbox "$system_to_delete has been deleted." 5 $menuwidth
126 $DIALOG --textbox $tempfile $menuheight $menuwidth
137 if $DIALOG --inputbox "Enter name of new node:" \
138 $menuheight $menuwidth 2>$tempfile ; then
140 new_node=`cat $tempfile`
141 if ./netsetup addnode $new_node 2>$tempfile; then
142 $DIALOG --msgbox "$new_node has been created." 5 $menuwidth
144 $DIALOG --textbox $tempfile $menuheight $menuwidth
153 tempfile=/tmp/dnetsetup.$$.1
154 tempfile2=/tmp/dnetsetup.$$.2
155 menucmd=/tmp/dnetsetup.$$.3
161 if $DIALOG --menu "Citadel/UX Network Setup" $menuheight $menuwidth 4 \
162 EDIT "View or change a network node" \
163 ADD "Add a new network node" \
164 DELETE "Delete a network node" \
165 EXIT "Exit from Network Setup" \
167 choice=`cat $tempfile`
173 [ $choice = "EXIT" ] && cleanup
174 [ $choice = "DELETE" ] && delete_network_nodes
175 [ $choice = "EDIT" ] && edit_a_node
176 [ $choice = "ADD" ] && add_a_node