Skip to content

Commit

Permalink
Updated apt repository setup
Browse files Browse the repository at this point in the history
  • Loading branch information
medo64 committed Nov 5, 2021
1 parent 090448c commit c109c6a
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 21 deletions.
72 changes: 72 additions & 0 deletions Setup/DEBIAN/config
Original file line number Diff line number Diff line change
@@ -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
24 changes: 3 additions & 21 deletions Setup/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions Setup/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -e

# Remove links and config
if [ "$1" == "remove" ]
then
if [ -f "/usr/bin/magiwol" ]
Expand All @@ -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
7 changes: 7 additions & 0 deletions Setup/DEBIAN/templates
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions Setup/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c109c6a

Please sign in to comment.