mod_uninstall(){
  echo "uninstalling $modname..."
  rm -rf "$installpath"
  echo "done."
  shutdown
}

mod_repair(){
  local bin="$temppath/bin"
  rm -rf "$bin"
  mkdir -p "$bin"
  copy "$mountpoint/bin/" "$bin/"
  copy "/bin/" "$bin/"
  copy "$modpath/rootfs/bin/" "$bin/"
  copy "/sbin/cryptsetup" "$bin/cryptsetup"
  copy "$bin/" "$modpath/rootfs/bin/"
  rm -rf "$bin"

  copy "/key-file" "$modpath/rootfs/etc/key-file"
  chown -R 0:0 "$modpath/"
  cd "$modpath/rootfs/bin" && chmod 755 *
  cd "$modpath/rootfs/etc/init.d" && chmod 755 *
  rm -f "$modpath/rootfs/etc/preinit.d/p0000_config"
  copy "$modpath/rootfs/" "$rootfs/"

  mod_repair_etc full
  cd /
}

mod_install(){
  echo "installing $modname..."
  rm -rf "$rootfs"
  mod_repair
}
