SVN: rc-scripts/trunk: rc.d/rc.sysinit src/getkey.c
arekm
arekm at pld-linux.org
Mon Aug 17 22:34:59 CEST 2009
Author: arekm
Date: Mon Aug 17 22:34:58 2009
New Revision: 10490
Modified:
rc-scripts/trunk/rc.d/rc.sysinit
rc-scripts/trunk/src/getkey.c
Log:
New getkey handling (from fc).
Modified: rc-scripts/trunk/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/trunk/rc.d/rc.sysinit (original)
+++ rc-scripts/trunk/rc.d/rc.sysinit Mon Aug 17 22:34:58 2009
@@ -990,13 +990,24 @@
chmod 0600 /var/log/dmesg /var/log/dmesg.0
fi
-kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
+if ! is_no "$RC_PROMPT"; then
+ while :; do
+ pid=$(/sbin/pidof getkey)
+ [ -n "$pid" -o -e /var/run/getkey_done ] && break
+ usleep 100000
+ done
+ [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1
+fi
} &
# extra check if the background process we just spawned is still running,
# as in case of vserver bootup it finishes quite instantly.
-if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
- /sbin/getkey -c 5 i && touch /var/run/confirm
+if ! is_no "$RC_PROMPT"; then
+ /sbin/getkey i && touch /var/run/confirm
+ touch /var/run/getkey_done
fi
wait
+if ! is_no "$RC_PROMPT"; then
+ rm -f /var/run/getkey_done
+fi
echo
Modified: rc-scripts/trunk/src/getkey.c
==============================================================================
--- rc-scripts/trunk/src/getkey.c (original)
+++ rc-scripts/trunk/src/getkey.c Mon Aug 17 22:34:58 2009
@@ -1,13 +1,19 @@
/*
* Copyright (c) 1999-2003, 2006 Red Hat, Inc. All rights reserved.
*
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
* getkey
*
* A very simple keygrabber.
More information about the pld-cvs-commit
mailing list