#!/bin/sh

set -eu

command=$1
shift

launcherone_links='
  /etc/udev/rules.d/85-novo-launcher-detect.rules
  /opt/novo/novoLauncher
  /usr/bin/novo-launcher
  /usr/share/appdata/novo-launcher.appdata.xml
  /usr/share/applications/novo-launcher.desktop
  /usr/share/icons/novo-launcher-icon.png
'

case "${command}" in
  configure)
    upstream_dir=$1
    for f in $launcherone_links; do
      mkdir -p "$(dirname "$f")"
      ln -fns -T "${upstream_dir}/${f}" "$f"
    done
    ;;
  unconfigure)
    rm -f $launcherone_links
    ;;
  unpack)
    upstream_pack=$1
    upstream_dir=$2
    dpkg-deb -x "$upstream_pack" "$upstream_dir"
    ;;
  *)
    ;;
esac
