post_install() {

#remove repo if existing
sed -n '1h;1!H;${g;s/###REPO for MEGA###\n.*###END REPO for MEGA###//;p;}' -i /etc/pacman.conf 

#include repo
cat >> /etc/pacman.conf <<-EOF
###REPO for MEGA###
[DEB_Arch_Extra]
SigLevel = Optional TrustAll
Server = https://mega.nz/linux/MEGAsync/Arch_Extra/\$arch
###END REPO for MEGA###
EOF

#Add public key used for signing
pacman-key --add - <<KEY
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)

mQENBFPabnIBCADWKHqC4LECg4tsv08azPQC2hnIs1jTnoNMIoIjmyoHnv1G+a1l
X7N1z9I6h+7J/CvRWodBDFRICCIQY3jezK/M/9hr3ACneXk33ferI2egLTlykg9m
6f+zLxmxfJZbeN/mv1qbLowEzptWS3E5Zdwni/pwyPjwclRUmYoiHIePMfMgZvd4
lkHzTTEQQKwwdGS1EaaOOjl8T0Mq92zzUMFYgrtx0ztnnD0T2d87+sz4uC56nCPx
ORTygAgy414d6a6SlCeD1GhNIrtYRe1Zy6WsiA4Z7OnVpuIJ8rEZa4PvjhpJ0/5f
shPifSvCY7RPdXKsCtUEn2nZDKdHtbF0HoYvABEBAAG0IE1lZ2FMaW1pdGVkIDxz
dXBwb3J0QG1lZ2EuY28ubno+iQE/BBMBAgApBQJT2m5yAhsDBQkJZgGABwsJCAcD
AgEGFQgCCQoLBBYCAwECHgECF4AACgkQS056lSOs0gEL0Qf/XeuRHcMVNdkuHdPn
YtOCjssPKgfh5alz6sfAtgxisjQVg6yQwd3+YcKPMCi5F7hewosFASWTcJbwkdAZ
kyHGFqt+SSR23bK1QX3y/5H8U2jHj+4E7yHmOWWC+RdJAOPJL3UrPh2BiWTOOmky
o+11CGOAo6wZETqK2e8jg32nh/hCa25Vl5ZcZ1xrSn7esBO0XarLiC9VvlcRPxQF
slHVAReFogvcxl6791ZD43XFP8VluScphMtP6M7DrsFqwAQ7hp6Yr3mRQB+si7gc
fTjKrwu0gApAPI96ICMZKT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