config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/dosemu/dosemu.conf.new
config etc/dosemu/global.conf.new
config etc/dosemu/dosemu.users.new

( cd etc/dosemu/drives ; rm -rf c )
( cd etc/dosemu/drives ; ln -sf /usr/share/dosemu/drive_z c )
( cd etc/dosemu/drives ; rm -rf d )
( cd etc/dosemu/drives ; ln -sf /usr/share/dosemu/drive_z d )
( cd usr/bin ; rm -rf xdosemu )
( cd usr/bin ; ln -sf dosemu xdosemu )
( cd usr/share/dosemu ; rm -rf commands )
( cd usr/share/dosemu ; ln -sf drive_z/dosemu commands )
( cd usr/share/dosemu/drive_z/bin ; rm -rf command.com )
( cd usr/share/dosemu/drive_z/bin ; ln -sf ../command.com command.com )
( cd usr/share/dosemu/drive_z/bin ; rm -rf join.exe )
( cd usr/share/dosemu/drive_z/bin ; ln -sf swsubst.exe join.exe )
( cd usr/share/dosemu/drive_z/bin ; rm -rf subst.exe )
( cd usr/share/dosemu/drive_z/bin ; ln -sf swsubst.exe subst.exe )
( cd usr/share/dosemu/drive_z/doc/assign ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/assign ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/attrib ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/attrib ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/bwbasic ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/bwbasic ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/choice ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/choice ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/cpidos ; rm -rf copying.txt )
( cd usr/share/dosemu/drive_z/doc/cpidos ; ln -sf ../copying copying.txt )
( cd usr/share/dosemu/drive_z/doc/deltree ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/deltree ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/diskcomp ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/diskcomp ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/diskcopy ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/diskcopy ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/display ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/display ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/edit ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/edit ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/edlin ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/edlin ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/exe2bin ; rm -rf exe2bin.txt )
( cd usr/share/dosemu/drive_z/doc/exe2bin ; ln -sf ../copying exe2bin.txt )
( cd usr/share/dosemu/drive_z/doc/fasthelp ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/fasthelp ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/fc ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/fc ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/find ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/find ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/format ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/format ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/freecom ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/freecom ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/kernel ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/kernel ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/label ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/label ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/lib ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/lib ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/mem ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/mem ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/mode ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/mode ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/more ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/more ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/move ; rm -rf copying.txt )
( cd usr/share/dosemu/drive_z/doc/move ; ln -sf ../copying copying.txt )
( cd usr/share/dosemu/drive_z/doc/nansi ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/nansi ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/replace ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/replace ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/share ; rm -rf copying )
( cd usr/share/dosemu/drive_z/doc/share ; ln -sf ../copying copying )
( cd usr/share/dosemu/drive_z/doc/sort ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/sort ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/tree ; rm -rf license.txt )
( cd usr/share/dosemu/drive_z/doc/tree ; ln -sf ../copying license.txt )
( cd usr/share/dosemu/drive_z/doc/wcd ; rm -rf copying.txt )
( cd usr/share/dosemu/drive_z/doc/wcd ; ln -sf ../copying copying.txt )
( cd usr/share/dosemu/drive_z/doc/xcopy ; rm -rf copying.txt )
( cd usr/share/dosemu/drive_z/doc/xcopy ; ln -sf ../copying copying.txt )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf blaster.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com blaster.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf bootoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com bootoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf booton.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com booton.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf cmdline.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com cmdline.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf dosdbg.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com dosdbg.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf dpmi.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com dpmi.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf ecpuoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com ecpuoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf ecpuon.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com ecpuon.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf eject.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com eject.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf emumouse.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com emumouse.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf exitemu.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com exitemu.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf lredir.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com lredir.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf speed.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com speed.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf system.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com system.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf uchdir.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com uchdir.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf ugetcwd.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com ugetcwd.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf unix.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com unix.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf vgaoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com vgaoff.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf vgaon.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com vgaon.com )
( cd usr/share/dosemu/drive_z/dosemu ; rm -rf xmode.com )
( cd usr/share/dosemu/drive_z/dosemu ; ln -sf generic.com xmode.com )
( cd usr/share/dosemu/drive_z ; rm -rf tmp )
( cd usr/share/dosemu/drive_z ; ln -sf /tmp tmp )
( cd usr/share/dosemu ; rm -rf freedos )
( cd usr/share/dosemu ; ln -sf drive_z freedos )
