Added autologin command, and use it by default.

* This will handle our current single-user login needs.
* Removed Login from the minimum image again.
This commit is contained in:
Axel Dörfler 2015-07-06 08:24:21 +02:00
parent 1281fcd3cb
commit 05a567f609
4 changed files with 36 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# This file defines the content of the minimum Haiku image.
SYSTEM_BIN = [ FFilterByBuildFeatures
addattr alert arp
addattr alert arp autologin
bc beep bfsinfo
catattr checkfs checkitout chop clear cmp collectcatkeys compress copyattr
dc desklink df diff diff3 diskimage draggers
@ -41,7 +41,6 @@ SYSTEM_APPS = [ FFilterByBuildFeatures
CharacterMap
Debugger DeskCalc Devices DiskProbe DiskUsage DriveSetup
Expander
Login
NetworkStatus
ProcessController
ShowImage StyledEdit

View File

@ -72,8 +72,7 @@ service x-vnd.Haiku-power_daemon {
}
target login {
job x-vnd.Haiku-Login {
launch /system/apps/Login
legacy
job x-vnd.Haiku-autologin {
launch /system/bin/autologin
}
}

View File

@ -77,6 +77,7 @@ StdBinCommands
# standard commands that need libbe.so
StdBinCommands
autologin.cpp
beep.cpp
catattr.cpp
checkfs.cpp

32
src/bin/autologin.cpp Normal file
View File

@ -0,0 +1,32 @@
/*
* Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <LaunchRoster.h>
int
main()
{
if (getuid() != 0)
return EXIT_FAILURE;
// TODO: This will obviously be done differently in a multi-user
// environment; we'll probably want to merge this with the standard
// login application then.
struct passwd* passwd = getpwuid(0);
if (passwd == NULL)
return EXIT_FAILURE;
status_t status = BLaunchRoster().StartSession(passwd->pw_name);
if (status != B_OK)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}