diff --git a/Setup/DEBIAN/config b/Setup/DEBIAN/config new file mode 100644 index 0000000..f921132 --- /dev/null +++ b/Setup/DEBIAN/config @@ -0,0 +1,72 @@ +#!/bin/sh -e + +# Show dialog if repository is not there +SOURCE_FILE="/etc/apt/sources.list.d/medo64.list" +if ! [ -f "$SOURCE_FILE" ] && [ "$DEBIAN_FRONTEND" != "noninteractive" ]; then + . /usr/share/debconf/confmodule + + db_input high magiwol/add_repository + db_go + db_get magiwol/add_repository + case "$RET" in + n*|N*|f*|F*) DO_ADD_REPO=0 ;; + esac +fi + +DO_ADD_REPO=0 +SOURCE_FILE="/etc/apt/sources.list.d/medo64.list" +if ! [ -f "$SOURCE_FILE" ] && [ "$DEBIAN_FRONTEND" != "noninteractive" ]; then + . /usr/share/debconf/confmodule + db_get magiwol/add_repository + case "$RET" in + y*|Y*|T*|t*) DO_ADD_REPO=1 ;; + esac +fi + +if [ "$DO_ADD_REPO" -ne 0 ]; then + echo "deb http://packages.medo64.com/deb stable main" > "$SOURCE_FILE" + if [ -d "/etc/apt/trusted.gpg.d/" ]; then + echo "-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFqxbGoBCACnavHwueNmk947TOkLDsnay/4uQIan79YFyHnv2zTFRuszuwFw +65sbflaBTjR57CZRzNyXHEcPb/NrxxuhXKHOXzbURy6FBv0CQZVjf9bm0Lroq5Ab +oZ9v0UZukpLoAyHkNca/zyHJoHtAq2Deq5X44dPRsCALn2zWJKya+hyA8ZYnGlcG +hERdnR8mMB+i0xb44rnDNY7GwdRykSialn3WopSFBrHv9pYOd2wtnrb3H9pFjT3H +jNp1+3/4mW6WDdVzC7mkJk9ia8mHqAw0IgtE7fP7HYcJnmdqCqgI3sZBR+D1VpyM +CgNGK6DrGD5IUp1ktZe2wAL8Jig2/Xmk02g7ABEBAAG0L0pvc2lwIE1lZHZlZCAo +UmVwb3NpdG9yeSkgPGptZWR2ZWRAam1lZHZlZC5jb20+iQE4BBMBCAAiBQJasWxq +AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRA4LnS5Ecf8hgj0B/0XeXn8 +aPkDLwHJzLbily9SUxn3WYcZhXEE1JSXtDHWI1owS/TT7kZxswHRh1DyZDQJSK0B +LCsHx1zoIVIvlkGz8PNfN+G/E+2CAI8/cdDBa5z8DM+w8wpQ02NZjWnS5pmpr3MT +sP7hLlyEeq/ErtKmZMlquDtTR7lUjundgtUIgofiSDiri/1xNynUmPgykkKR/vR2 +mrPHCxIqiEEq5RkFvIDpH6zltld97AeNP2vEcmkpyS9npFRkHgPNjxZhvHhhjbHP +pXF542bTCX+bXOfPWbdl/mnIBRKdsNGNu/FbXTQ4gEmXQwmki5YL8kRwbBloxuH2 +5VcfjRkkgrnxUy4S +=gY4j +-----END PGP PUBLIC KEY BLOCK-----" > /etc/apt/trusted.gpg.d/medo64.asc + else # add it using deprecated apt-key + echo "-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFqxbGoBCACnavHwueNmk947TOkLDsnay/4uQIan79YFyHnv2zTFRuszuwFw +65sbflaBTjR57CZRzNyXHEcPb/NrxxuhXKHOXzbURy6FBv0CQZVjf9bm0Lroq5Ab +oZ9v0UZukpLoAyHkNca/zyHJoHtAq2Deq5X44dPRsCALn2zWJKya+hyA8ZYnGlcG +hERdnR8mMB+i0xb44rnDNY7GwdRykSialn3WopSFBrHv9pYOd2wtnrb3H9pFjT3H +jNp1+3/4mW6WDdVzC7mkJk9ia8mHqAw0IgtE7fP7HYcJnmdqCqgI3sZBR+D1VpyM +CgNGK6DrGD5IUp1ktZe2wAL8Jig2/Xmk02g7ABEBAAG0L0pvc2lwIE1lZHZlZCAo +UmVwb3NpdG9yeSkgPGptZWR2ZWRAam1lZHZlZC5jb20+iQE4BBMBCAAiBQJasWxq +AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRA4LnS5Ecf8hgj0B/0XeXn8 +aPkDLwHJzLbily9SUxn3WYcZhXEE1JSXtDHWI1owS/TT7kZxswHRh1DyZDQJSK0B +LCsHx1zoIVIvlkGz8PNfN+G/E+2CAI8/cdDBa5z8DM+w8wpQ02NZjWnS5pmpr3MT +sP7hLlyEeq/ErtKmZMlquDtTR7lUjundgtUIgofiSDiri/1xNynUmPgykkKR/vR2 +mrPHCxIqiEEq5RkFvIDpH6zltld97AeNP2vEcmkpyS9npFRkHgPNjxZhvHhhjbHP +pXF542bTCX+bXOfPWbdl/mnIBRKdsNGNu/FbXTQ4gEmXQwmki5YL8kRwbBloxuH2 +5VcfjRkkgrnxUy4S +=gY4j +-----END PGP PUBLIC KEY BLOCK-----" | apt-key add - + fi +fi + +# Done +exit 0 diff --git a/Setup/DEBIAN/postinst b/Setup/DEBIAN/postinst index 8151fac..1613a6f 100644 --- a/Setup/DEBIAN/postinst +++ b/Setup/DEBIAN/postinst @@ -1,27 +1,9 @@ #!/bin/bash +set -e +# Set links chmod +x /opt/magiwol/magiwol.exe ln -s /opt/magiwol/magiwol.exe /usr/bin/magiwol -echo "deb https://medo64.com/repositories/deb stable main" > /etc/apt/sources.list.d/medo64.list -echo "-----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQENBFqxbGoBCACnavHwueNmk947TOkLDsnay/4uQIan79YFyHnv2zTFRuszuwFw -65sbflaBTjR57CZRzNyXHEcPb/NrxxuhXKHOXzbURy6FBv0CQZVjf9bm0Lroq5Ab -oZ9v0UZukpLoAyHkNca/zyHJoHtAq2Deq5X44dPRsCALn2zWJKya+hyA8ZYnGlcG -hERdnR8mMB+i0xb44rnDNY7GwdRykSialn3WopSFBrHv9pYOd2wtnrb3H9pFjT3H -jNp1+3/4mW6WDdVzC7mkJk9ia8mHqAw0IgtE7fP7HYcJnmdqCqgI3sZBR+D1VpyM -CgNGK6DrGD5IUp1ktZe2wAL8Jig2/Xmk02g7ABEBAAG0L0pvc2lwIE1lZHZlZCAo -UmVwb3NpdG9yeSkgPGptZWR2ZWRAam1lZHZlZC5jb20+iQE4BBMBCAAiBQJasWxq -AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRA4LnS5Ecf8hgj0B/0XeXn8 -aPkDLwHJzLbily9SUxn3WYcZhXEE1JSXtDHWI1owS/TT7kZxswHRh1DyZDQJSK0B -LCsHx1zoIVIvlkGz8PNfN+G/E+2CAI8/cdDBa5z8DM+w8wpQ02NZjWnS5pmpr3MT -sP7hLlyEeq/ErtKmZMlquDtTR7lUjundgtUIgofiSDiri/1xNynUmPgykkKR/vR2 -mrPHCxIqiEEq5RkFvIDpH6zltld97AeNP2vEcmkpyS9npFRkHgPNjxZhvHhhjbHP -pXF542bTCX+bXOfPWbdl/mnIBRKdsNGNu/FbXTQ4gEmXQwmki5YL8kRwbBloxuH2 -5VcfjRkkgrnxUy4S -=gY4j ------END PGP PUBLIC KEY BLOCK-----" | apt-key add - - +# Done exit 0 diff --git a/Setup/DEBIAN/postrm b/Setup/DEBIAN/postrm index 11be65f..8e95612 100644 --- a/Setup/DEBIAN/postrm +++ b/Setup/DEBIAN/postrm @@ -1,5 +1,7 @@ #!/bin/bash +set -e +# Remove links and config if [ "$1" == "remove" ] then if [ -f "/usr/bin/magiwol" ] @@ -13,4 +15,11 @@ then fi fi +# Purge debconf +if [ "$1" = "purge" -a -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi + +# Done exit 0 diff --git a/Setup/DEBIAN/templates b/Setup/DEBIAN/templates new file mode 100644 index 0000000..3ba9117 --- /dev/null +++ b/Setup/DEBIAN/templates @@ -0,0 +1,7 @@ +Template: magiwol/add_repository +Type: boolean +Default: true +Description: Should the repository be added to the system? + If selected, the repository for the package will be added for the purpose + of simplifying the future upgrades. If not added, each update will have to + be manually installed. diff --git a/Setup/package.sh b/Setup/package.sh index 809d62c..c2a9544 100644 --- a/Setup/package.sh +++ b/Setup/package.sh @@ -108,6 +108,7 @@ cp -R ./usr $DIRECTORY_PACKAGE/ find $DIRECTORY_PACKAGE -type d -exec chmod 755 {} + find $DIRECTORY_PACKAGE -type f -exec chmod 644 {} + +chmod 755 $DIRECTORY_PACKAGE/DEBIAN/config chmod 755 $DIRECTORY_PACKAGE/DEBIAN/*inst chmod 755 $DIRECTORY_PACKAGE/DEBIAN/*rm