Create aiy-board-tools package, w/ reboot-bootloader script

Change-Id: If7de07d644663c03bfbc404a0014addc7796a2f4
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..877048f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+prefix = /usr/local
+OUT_DIR := $(DESTDIR)$(prefix)
+
+all:
+	true
+
+install:
+	install -d $(OUT_DIR)/sbin
+	install -m 755 -o 0 -g 0 reboot-bootloader $(OUT_DIR)/sbin
+
+.PHONY:: all install
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..acc1373
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+aiy-board-tools (0.1) UNRELEASED; urgency=medium
+
+  * Initial release.
+
+ -- AIY Projects <support-aiyprojects@google.com>  Mon, 04 Jun 2018 16:14:00 -0800
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..9d32f91
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,10 @@
+Source: aiy-board-tools
+Maintainer: AIY Projects <support-aiyprojects@google.com>
+Build-Depends: debhelper, gnupg
+
+Package: aiy-board-tools
+Section: misc
+Priority: required
+Architecture: all
+Depends: python3-minimal
+Description: Miscellaneous tools to support the AIY Board
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..52b67a7
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,7 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: aiy-board-tools
+Source: https://aiyprojects.googlesource.com/aiy-board-tools
+
+Files: *
+Copyright: Copyright 2018 Google, LLC <support-aiyprojects@google.com>
+License: Apache-2.0
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..74918df
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+%:
+	dh $@
+
+override_dh_shlibdeps:
+	true
+
+override_dh_auto_install:
+	dh_auto_install -- prefix=/usr
diff --git a/reboot-bootloader b/reboot-bootloader
new file mode 100644
index 0000000..65ff708
--- /dev/null
+++ b/reboot-bootloader
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if os.geteuid() != 0:
+  print('Can not reboot as a normal user. Please re-run with sudo.')
+  exit(1)
+
+misc_path = os.path.join(os.sep, 'dev', 'disk', 'by-partlabel', 'misc')
+if not os.path.exists(misc_path):
+  print('Could not find a misc partition! Giving up.')
+  sys.exit(1)
+
+with open(misc_path, 'wb') as misc:
+  misc.write(b'bootonce-bootloader')
+
+subprocess.run('reboot')
\ No newline at end of file