Commit a3ff5356 authored by Bojan Kogoj's avatar Bojan Kogoj
Browse files

Merge remote-tracking branch 'redox/master' into bojan/calendar

parents 5d224baf f88b8029
This diff is collapsed.
......@@ -60,7 +60,7 @@ orbimage = "0.1"
orbtk = "0.2"
tendril = "0.4"
url = "1.5"
userutils = { git = "https://github.com/redox-os/userutils.git" }
redox_users = { git = "https://github.com/redox-os/users.git" }
[dependencies.hyper]
version = "0.10"
......
......@@ -5,3 +5,28 @@ The Orbital Utilities. Compatible with Redox and SDL2 platforms.
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![crates.io](http://meritbadge.herokuapp.com/orbutils)](https://crates.io/crates/orbutils)
## Quick setup
To run on Linux/OSX you will need SDL2
Install SDL2 on Debian-based systems
```
sudo apt-get install libsdl2-dev
```
Install on OSX using Homebrew
```
brew install sdl2
```
You will need Rust nightly installed
```
curl https://sh.rustup.rs -sSf | sh
rustup override set nightly
```
Clone and run
```
git clone https://github.com/redox-os/orbutils.git
cargo run --bin calculator
```
......@@ -4,7 +4,7 @@
extern crate orbclient;
extern crate orbimage;
extern crate orbfont;
extern crate userutils;
extern crate redox_users;
use std::{env, str};
use std::fs::File;
......@@ -15,7 +15,7 @@ use std::process::Command;
use orbclient::{Color, EventOption, Renderer, Window, WindowFlag};
use orbfont::Font;
use orbimage::Image;
use userutils::Passwd;
use redox_users::User;
#[derive(Clone, Copy)]
enum BackgroundMode {
......@@ -85,7 +85,7 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St
let mut passwd_option = None;
for line in passwd_string.lines() {
if let Ok(passwd) = Passwd::parse(line) {
if let Ok(passwd) = User::parse(line) {
if user == passwd.user && "" == passwd.hash {
passwd_option = Some(passwd);
break;
......@@ -95,8 +95,8 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St
if passwd_option.is_none() {
for line in passwd_string.lines() {
if let Ok(passwd) = Passwd::parse(line) {
if user == passwd.user && passwd.verify(&pass) {
if let Ok(passwd) = User::parse(line) {
if user == passwd.user && passwd.verify_passwd(&pass) {
passwd_option = Some(passwd);
break;
}
......@@ -113,12 +113,12 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St
command.uid(passwd.uid);
command.gid(passwd.gid);
command.current_dir(passwd.home);
command.current_dir(passwd.home.clone());
command.env("USER", &user);
command.env("UID", format!("{}", passwd.uid));
command.env("GROUPS", format!("{}", passwd.gid));
command.env("HOME", passwd.home);
command.env("HOME", passwd.home.clone());
command.env("SHELL", passwd.shell);
Some(command)
......
Supports Markdown
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