summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-27 12:58:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-27 12:58:32 +0000
commitd3551589c911a40239d5be2b7ddc414f89dd548f (patch)
tree501c9d7f6a3c8a44376280563dbc1603cccb7349
parent9470b4477a6745cd40256a13a66e82a96eea9cdd (diff)
downloaddrakx-d3551589c911a40239d5be2b7ddc414f89dd548f.tar
drakx-d3551589c911a40239d5be2b7ddc414f89dd548f.tar.gz
drakx-d3551589c911a40239d5be2b7ddc414f89dd548f.tar.bz2
drakx-d3551589c911a40239d5be2b7ddc414f89dd548f.tar.xz
drakx-d3551589c911a40239d5be2b7ddc414f89dd548f.zip
at last a good reboot/halt from kde
-rw-r--r--mdk-stage1/init.c16
-rwxr-xr-xmove/make_live1
-rw-r--r--move/move.pm7
-rw-r--r--move/tree/Reboot.desktop13
-rwxr-xr-xmove/tree/X_move2
-rwxr-xr-xmove/tree/halt_reboot9
-rwxr-xr-xmove/tree/startkde_move2
7 files changed, 23 insertions, 27 deletions
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c
index f08e423f1..ac9154dcd 100644
--- a/mdk-stage1/init.c
+++ b/mdk-stage1/init.c
@@ -336,6 +336,18 @@ void unmount_filesystems(void)
}
}
+int in_reboot(void)
+{
+ int fd;
+ if ((fd = open("/var/run/rebootctl", O_RDONLY, 0)) > 0) {
+ char buf[1];
+ int i = read(fd, buf, sizeof(buf));
+ close(fd);
+ return i > 0;
+ }
+ return 0;
+}
+
int exit_value_proceed = 66;
int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
@@ -422,8 +434,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))
end_stage2 = 1;
}
- if ((fd = open("/tmp/reboot", O_RDONLY, 0)) > 0) {
- close(fd);
+ if (in_reboot()) {
+ // any exitcode is valid if we're in_reboot
} else if (!WIFEXITED(wait_status) || (WEXITSTATUS(wait_status) != 0 && WEXITSTATUS(wait_status) != exit_value_proceed)) {
printf("exited abnormally :-( ");
if (WIFSIGNALED(wait_status))
diff --git a/move/make_live b/move/make_live
index acf6c955b..1a9642b21 100755
--- a/move/make_live
+++ b/move/make_live
@@ -90,7 +90,6 @@ print "Making live in $::prefix directory.\n";
installPackages();
run_program::rooted($::prefix, 'ldconfig');
touch("$::prefix/etc/menu/enable_simplified");
- cp_af('tree/Reboot.desktop', "$::prefix/usr/share/applnk-mdk-simplified");
$ENV{LC_ALL} = 'en_US'; #- update-menus doesn't work when there is no locale (aka locale "C")
run_program::rooted($::prefix, 'update-menus', '-n');
run_program::rooted($::prefix, 'fc-cache'); #- generate cache in all directories mentioned in config file
diff --git a/move/move.pm b/move/move.pm
index abdf35575..e2377fd7b 100644
--- a/move/move.pm
+++ b/move/move.pm
@@ -153,6 +153,8 @@ sub init {
install2::handleI18NClp();
}
+ touch '/var/run/rebootctl';
+
drakx_stuff:
$o->{steps}{$_} = { reachable => 1, text => $_ }
foreach qw(initGraphical autoSelectLanguage handleI18NClp verifyKey configMove startMove);
@@ -289,7 +291,7 @@ sub key_installfiles {
}
sub reboot {
- touch '/tmp/reboot'; #- tell X_move to not respawn
+ output('/var/run/rebootctl', "reboot"); #- tell X_move to not respawn
system("killall X"); #- kill it ourselves to be sure that it won't lock console when killed by our init
exit 0;
}
@@ -536,6 +538,8 @@ sub install2::startMove {
output("/var/run/console/$username", 1);
run_program::run('pam_console_apply');
+ run_program::run('chown', "$username.root", '/var/run/rebootctl');
+
touch '/var/run/utmp';
run_program::run('runlevel_set', '5');
member($_, qw(xfs dm devfsd syslog)) or run_program::run($_, 'start') foreach glob('/etc/rc.d/rc5.d/*');
@@ -560,6 +564,7 @@ sub install2::startMove {
$ENV{LOGNAME} = $ENV{USER} = $username;
$ENV{HOME} = $home;
$ENV{SHELL} = $shell;
+ $ENV{XDM_MANAGED} = '/var/run/rebootctl,maysd,mayfn,sched'; #- for reboot/halt availability of "logout" by kde
exec 'startkde_move';
} else {
exec 'xwait' or c::_exit(0);
diff --git a/move/tree/Reboot.desktop b/move/tree/Reboot.desktop
deleted file mode 100644
index 71449b6c2..000000000
--- a/move/tree/Reboot.desktop
+++ /dev/null
@@ -1,13 +0,0 @@
-[Desktop Entry]
-Name=Reboot
-Exec=halt_reboot
-Terminal=false
-Icon=exit.png
-Type=Application
-Separator=true
-ForceLast=true
-
-Name[fr]=Redémarrer
-Name[it]=Riavvia
-Name[es]=Reiniciar
-Name[de]=Neustart
diff --git a/move/tree/X_move b/move/tree/X_move
index a5969ed9a..0656468ad 100755
--- a/move/tree/X_move
+++ b/move/tree/X_move
@@ -1,7 +1,7 @@
#!/bin/bash
ok=0
-while [ "$ok" == 0 -a ! -f /tmp/reboot ]; do
+while [ "$ok" == 0 -a ! -s /var/run/rebootctl ]; do
X $@
ok=$?
done
diff --git a/move/tree/halt_reboot b/move/tree/halt_reboot
index d31032fe6..b4b1d4ede 100755
--- a/move/tree/halt_reboot
+++ b/move/tree/halt_reboot
@@ -1,10 +1,5 @@
#!/bin/sh
+echo "reboot" > /var/run/rebootctl
sudo killall -USR1 startkde_move
-
-if [ $UID == 0 ]; then
- user=`getent passwd 501 | perl -ne 'print $1 if /([^:]+):/'`
- su $user -c 'dcop kdesktop default logout'
-else
- dcop kdesktop default logout
-fi \ No newline at end of file
+sudo killall X
diff --git a/move/tree/startkde_move b/move/tree/startkde_move
index 402803b5e..e8bec3da7 100755
--- a/move/tree/startkde_move
+++ b/move/tree/startkde_move
@@ -2,8 +2,6 @@
#- exit cleanly on SIGUSR1, so that our init can see a clean shutdown and automatically reboot
reboot () {
- touch /tmp/reboot
- sudo killall X
exit 0
}
trap 'reboot' SIGUSR1