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