File: login

package info (click to toggle)
glome 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 716 kB
  • sloc: ansic: 2,468; python: 508; sh: 149; makefile: 20
file content (33 lines) | stat: -rwxr-xr-x 676 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

set -e

CONFIG=/etc/glome/config
PRIVATE=$AUTOPKGTEST_TMP/private

UMASK=$(umask)
umask 077
PUBLIC_KEY=$(glome genkey | tee $PRIVATE | glome pubkey)
umask "$UMASK"

sed -i "s/^#\\?public-key = .*/public-key = $PUBLIC_KEY/" $CONFIG

expect 2>$AUTOPKGTEST_ARTIFACTS/login.log <<EOF
strace 1
spawn /usr/sbin/glome-login -- root
set timeout 30
expect_before {
  eof { puts "\nExpect eof"; exit 1 }
  timeout { puts "\nExpect timeout"; exit 2 }
}
expect -re "GLOME: (v2/.*/)"
set resp [exec glome login --key $PRIVATE \$expect_out(1,string)]
expect "> "
send -- "\$resp\\n"
expect "Authorization code: OK"
sleep 5
expect "# "
send "id\\n"
expect "uid=0(root)"
close
EOF