# # This is a helper script for FUBAR, which creates user preferences # directory and populates it with default files, taken from system-wide # library directory # if [llength [info command link]] { proc symlink {source dest} { link -sym $source $dest } } else { proc symlink {source dest} { exec ln -s $source $dest } } # # variables CONFIGDIR and LIBRARYDIR should be provided by invoking # script # proc copyhier {src dest} { file mkdir $dest foreach f [glob -nocomplain $src/*] { set s [file join $dest [file tail $f]] if [catch {file readlink $f} d] { if [file isdirectory $f] { copyhier $f $s } else { symlink $f $s } } else { symlink $d $s } } } file mkdir $CONFIGDIR copyhier $LIBRARYDIR/menu $CONFIGDIR/menu foreach file [glob -nocomplain $LIBRARYDIR/plugins/*] { # skip documentation if {[string match *.txt $file]} continue symlink $f [file join $CONFIGDIR plugins [file tail $file]] } foreach f {hosts associations holydays} { if [file exists $LIBRARYDIR/$f] { file copy $LIBRARYDIR/$f $CONFIGDIR/$f } } symlink $LIBRARYDIR/mail $CONFIGDIR/mail close [open "$CONFIGDIR/phonebook" a+]