Refactor debian packaging

Review 971
Closes #1072