Commit 19c0cf12 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: use trap EXIT to remove tmp files

parent 7868d879
......@@ -28,6 +28,7 @@ fi
# parse vendor site
tmpfile=$(mktemp)
trap "rm -f $tmpfile" EXIT
epm tool eget -q -O- "$URL" | grep -A200 "Ассистент для LINUX" >$tmpfile
url_by_text()
......@@ -57,8 +58,6 @@ case $arch-$pkg in
;;
esac
rm $tmpfile
# after repack on ALT:
# assistant: Требует: /lib/init/vars.sh но пакет не может быть установлен
# Требует: libyuv.so()(64bit) но пакет не может быть установлен
......
......@@ -29,10 +29,9 @@ pack_ffmpeg() {
}
DDIR=$(mktemp -d)
trap "rm -fr $DDIR" EXIT
cd $DDIR || fatal
epm tool eget $FFMPEG_URL_DEB || fatal
a='' ar -x *.deb
a='' tar xf "data.tar.xz"
pack_ffmpeg
rm -rf $DDIR
rm -f $SC
......@@ -11,18 +11,18 @@ VERSION=9.6.2
IPFSHASH=Qmd38jJnTnUMUeJuKSDBGesqXF3SxEahUVZc6NUPyMKgj1
PKGURL="https://trial2.autodesk.com/NET17SWDLD/2017/EGLPRM/ESD/Autodesk_EAGLE_${VERSION}_English_Linux_64bit.tar.gz"
# use temp dir
PKGDIR="$(mktemp -d)"
trap "rm -fr $PKGDIR" EXIT
cd $PKGDIR || fatal
if ! epm tool eget $PKGURL ; then
echo "It is possible you are blocked from USA, trying get from IPFS ..."
pkgname=$(basename $PKGURL)
epm tool eget -O $pkgname http://dhash.ru/ipfs/$IPFSHASH || fatal "Can't get $pkgname from IPFS."
fi
epm install --repack *.tar.gz
RES=$?
rm -rfv $PKGDIR
epm install --repack *.tar.gz || exit
echo
echo "
......
......@@ -21,10 +21,8 @@ epm assure wget || fatal
# hack due ОШИБКА: невозможно проверить сертификат app.ktalk.ru, выпущенный «CN=RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1,O=DigiCert Inc,C=US»
PKGDIR="$(mktemp -d)"
trap "rm -fr $PKGDIR" EXIT
cd $PKGDIR || fatal
epm tool eget --no-check-certificate "$URL" || fatal
epm install *.AppImage
RES=$?
rm -rf $PKGDIR
exit $RES
......@@ -15,9 +15,9 @@ fi
PKGURL=$(epm tool eget --list --latest https://github.com/telegramdesktop/tdesktop/releases "tsetup.*.tar.xz") #"
[ -n "$PKGURL" ] || fatal "Can't get package URL"
PKGFILE=$(echo /tmp/$(basename $PKGURL) | sed -e "s|/tsetup|/$PKGNAME|")
PKGDIR=$(mktemp -d)
trap "rm -fr $PKGDIR" EXIT
PKGFILE=$(echo $PKGDIR/$(basename $PKGURL) | sed -e "s|/tsetup|/$PKGNAME|")
epm tool eget -O $PKGFILE $PKGURL || exit
epm install --repack "$PKGFILE" || exit
rm -fv $PKGFILE
epm install --repack "$PKGFILE"
......@@ -38,12 +38,12 @@ esac
# workaround for --noscripts for apt-get
if [ -n "$epmopt" ] ; then
tmpdir=$(mktemp -d)
trap "rm -fr $tmpdir" EXIT
cd $tmpdir || fatal
epm tool eget $URL || fatal
PKG=$(echo *)
epm install $(epm req $PKG) || fatal "Can't install requirements of the trueconf package"
epm install $epmopt "$PKG" || exit
rm -rf $tmpdir
exit 0
fi
......
......@@ -36,6 +36,7 @@ esac
pkgtype="$($DISTRVENDOR -p)"
tdir=$(mktemp -d)
trap "rm -fr $tdir" EXIT
mkdir -p $tdir/opt/$PKGNAME/
cd $tdir || fatal
......@@ -59,16 +60,10 @@ VERSION="$(epm tool eget -O- https://virtualhere.com/usb_server_software | grep
PKG=$PKGNAME-$VERSION.tar
pack_tar $PKG opt/$PKGNAME/$BINNAME
epm install --repack "$PKG"
RES=$?
rm -rf $tdir
[ "$RES" = "0" ] || exit $RES
epm install --repack "$PKG" || exit
echo
echo "Note: run
# serv $PKGNAME on
to enable and start $PKGNAME system service
"
......@@ -34,15 +34,16 @@ pack_ffmpeg() {
# download ffmpeg with upstream script update-ffmpeg but with our pack_ffmpeg function
[ -s $PRODUCTDIR/update-ffmpeg ] || fatal "$PRODUCTDIR/update-ffmpeg is missed"
SC=$(mktemp)
DDIR=$(mktemp -d)
trap "rm -fr $SC $DDIR" EXIT
a='' awk 'BEGIN{desk=0}{ if(/^.*--system.*/&&desk==0){desk++} ; if (desk==0) {print} }' < $PRODUCTDIR/update-ffmpeg > $SC
. $SC
DDIR=$(mktemp -d)
cd $DDIR || fatal
epm tool eget $FFMPEG_URL_DEB
SUITABLE_URLS=$FFMPEG_URL_DEB
a='' ar -x *.deb
a='' tar xf "data.tar.xz"
pack_ffmpeg
rm -rf $DDIR
rm -f $SC
......@@ -38,8 +38,8 @@ update_url_if_need_mirrored
# download ffmpeg with upstream script update-ffmpeg but with our pack_ffmpeg function
[ -s $PRODUCTDIR/update-ffmpeg ] || fatal "$PRODUCTDIR/update-ffmpeg is missed"
SC=$(mktemp)
trap "rm -f $SC" EXIT
sed -e 's|install_ffmpeg &&|pack_ffmpeg \&\&|' \
-e 's|wget -q-O|epm tool eget -q -O-|' \
-e "s|CODECS_JSON_URL='https://browser-resources.s3.yandex.net/linux/codecs.json'|CODECS_JSON_URL='$URL'|" < $PRODUCTDIR/update-ffmpeg > $SC
. $SC
rm -f $SC
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment