Kaynağa Gözat

Check that the user exists

Bob Mottram 10 yıl önce
ebeveyn
işleme
1a798d893d
1 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 9
    5
      install-freedombone.sh

+ 9
- 5
install-freedombone.sh Dosyayı Görüntüle

@@ -94,19 +94,23 @@ fi
94 94
 function argument_checks {
95 95
   echo './install-freedombone.sh [domain] [username] [subdomain code]'
96 96
   echo ''
97
+  if [ ! -d /home/$MY_USERNAME ]; then
98
+	  echo "There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
99
+	  exit 1
100
+  fi
97 101
   if [ ! $DOMAIN_NAME ]; then
98 102
 	  echo 'Please specify your domain name'
99
-	  exit
103
+	  exit 2
100 104
   fi
101 105
   if [ ! $MY_USERNAME ]; then
102 106
 	  echo 'Please specify your username'
103
-	  exit
107
+	  exit 3
104 108
   fi
105 109
   if [ ! $FREEDNS_SUBDOMAIN_CODE ]; then
106 110
       echo 'Please specify the freedns subdomain code.  To find it from '
107 111
       echo "https://freedns.afraid.org select 'Dynamic DNS', then 'quick "
108 112
       echo "cron example' and copy the code located between '?' and '=='."
109
-	  exit
113
+	  exit 4
110 114
   fi
111 115
 }
112 116
 
@@ -845,11 +849,11 @@ function configure_gpg {
845 849
 	  # use your existing GPG keys which were exported
846 850
 	  if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
847 851
 		  echo "GPG public key file $MY_GPG_PUBLIC_KEY was not found"
848
-		  exit 1
852
+		  exit 5
849 853
 	  fi
850 854
 	  if [ ! -f $MY_GPG_PRIVATE_KEY ]; then
851 855
 		  echo "GPG private key file $MY_GPG_PRIVATE_KEY was not found"
852
-		  exit 1
856
+		  exit 6
853 857
 	  fi
854 858
       su - $MY_USERNAME gpg --import $MY_GPG_PUBLIC_KEY
855 859
       su - $MY_USERNAME gpg --allow-secret-key-import --import $MY_GPG_PRIVATE_KEY