summaryrefslogtreecommitdiff
path: root/net/freenx/files/patch-freenx-nxsetup
blob: 0483fbcb247715dd99fb071831992e83554a8a8c (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--- freenx-0.4.1/nxsetup.orig	Tue Feb 15 19:00:31 2005
+++ freenx-0.4.1/nxsetup	Mon Mar 28 15:53:10 2005
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/local/bin/bash
 
 # Coypright (c) 2004-2005 by Fabian Franz <freenx@fabian-franz.de>.
 #                    2005 by Jon Severinsson <jonno@users.berlios.de>.
@@ -97,7 +97,9 @@
 {
 	set -e
 	
-	if [ "$(pidof sshd)" = "" ]
+	#if [ "$(pidof sshd)" = "" ]
+	MAYBE_PID=`cat /var/run/sshd.pid`
+	if test -z "$MAYBE_PID"
 	then 
 		echo -n "Starting ssh service ..."
 		# Generate Host keys if they are not available, yet
@@ -129,10 +131,12 @@
 	chmod 600 "$NX_LOGFILE"
 	echo "done"
 	
-	if ! { getent passwd | egrep -q "^nx:"; }
+	#if ! { getent passwd | egrep -q "^nx:"; }
+	if ! { cat /etc/passwd |egrep -q "^nx:"; }
 	then
 		echo -n "Setting up user nx ..."
-		useradd_nx
+		#useradd_nx
+		pw useradd nx -d $NX_HOME_DIR -s $PATH_BIN/nxserver
 		echo "done"
 	fi
 	
@@ -173,19 +177,22 @@
 	echo "done"
 	
 	echo -n "Setting up permissions ..."
-	chown -R nx:root $NX_SESS_DIR
-	chown -R nx:root $NX_ETC_DIR
-	chown -R nx:root $NX_HOME_DIR
-	chown nx:root "$NX_LOGFILE"
+	chown -R nx:nx $NX_SESS_DIR
+	chown -R nx:nx $NX_ETC_DIR
+	chown -R nx:nx $NX_HOME_DIR
+	chown nx:nx "$NX_LOGFILE"
+	chmod 0400 $NX_HOME_DIR/.ssh/$SSH_AUTHORIZED_KEYS
 	echo "done"
 }
 
 uninstall_nx() 
 {
-	if { getent passwd | egrep -q "^nx:"; }
+	#if { getent passwd | egrep -q "^nx:"; }
+	if { cat /etc/passwd | egrep -q "^nx:"; }
 	then
 		echo -n "Removing user nx ..."
-		userdel nx
+		#userdel nx
+		pw userdel nx
 		echo "done"
 	fi