From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 18 Feb 2010 16:42:54 +0300 From: "Dmitry V. Levin" To: Alexey Gladkov Message-ID: <20100218134254.GF11639@wo.int.altlinux.org> Mail-Followup-To: Alexey Gladkov , ALT Devel discussion list References: <20100218130528.9EDB91D9675A@ssh.git.orion.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XIiC+We3v3zHqZ6Z" Content-Disposition: inline In-Reply-To: <20100218130528.9EDB91D9675A@ssh.git.orion.altlinux.org> X-fingerprint: FE4C 93AB E19A 2E4C CB5D 3E4E 7CAB E6AC 9E35 361E Cc: ALT Devel discussion list Subject: [devel] A: trap shell builtin (was: [SCM] packages/make-initrd: heads/master) X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2010 13:42:54 -0000 Archived-At: List-Archive: List-Post: --XIiC+We3v3zHqZ6Z Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 18, 2010 at 04:05:28PM +0300, Alexey Gladkov wrote: > Update of /people/legion/packages/make-initrd.git [...] > --- a/make-initrd.in > +++ b/make-initrd.in > @@ -1,4 +1,25 @@ > #!/bin/sh -efu > =20 > +PROG=3D"${0##*/}" > +TEMPDIR=3D > +term_handler() { > + local rc=3D$? > + [ -z "$TEMPDIR" ] || rm -rf -- "$TEMPDIR" > + exit $rc > +} > + > +exit_handler() { > + local rc=3D$? > + trap - EXIT > + [ -z "$TEMPDIR" ] || rmdir -- "$TEMPDIR" 2>/dev/null ||: > + exit $rc > +} > + > + > +TEMPDIR=3D"$(mktemp -d "@TMPDIR@/$PROG.XXXXXXXXX")" > +trap term_handler HUP INT QUIT TERM > +trap exit_handler EXIT =FC=D4=CF =D5=D6=C5 =D3=CF=D7=D3=C5=CD =D3=D4=C1=D2=D9=C5 =C7=D2=C1=C2=CC= =C9: term_handler =D5=D3=D4=C1=CE=C1=D7=CC=C9=D7=C1=C5=D4 =D3=CC=D5=DE=C1= =CA=CE=D9=CA =CB=CF=C4 =D7=CF=DA=D7=D2=C1=D4=C1 =C9 =D5=C4=C1=CC=D1=C5=D4 $TEMPDIR =C4=D7=C1=D6=C4= =D9. =F0=CF=C4=D2=CF=C2=CE=C5=C5 =CE=C1 =DC=D4=D5 =D4=C5=CD=D5 =D3=CD. http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00361.html http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00377.html There is an interesting reading about portability issues related to shell "trap" builtin: http://www.gnu.org/software/hello/manual/autoconf/Limitations-of-Builtins.h= tml#trap --=20 ldv --XIiC+We3v3zHqZ6Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkt9Q94ACgkQfKvmrJ41Nh7SUgCbB6Xnkk8wr6MWbsiGzQV9oGra xDIAn3/A5PMKR+uOoce/WUOushmtF2nX =aHrw -----END PGP SIGNATURE----- --XIiC+We3v3zHqZ6Z--