Guest User

Untitled

a guest
Jul 16th, 2018
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.40 KB | None | 0 0
  1. #!/bin/sh
  2. export LANG=en_US.UTF-8
  3. export GTK2_RC_FILES=/usr/share/themes/Xfce/gtk-2.0/gtkrc
  4. export WALLPAPER=/usr/share/pyra/wallpapers/official/pyra-a-720.png
  5.  
  6. #xmodmap /etc/skel/.Xmodmap
  7. #hsetroot -cover $WALLPAPER
  8.  
  9. #XXXX To do
  10. #Ask user what language they speak, Only problem is: This wizard will be in english to begin with
  11. # Merge Firstname / Username / hostname / password sections, have password confirm automatically - This would look nicer for the user
  12. #Ask Firewall and encryption stuff on same page
  13. # Perhaps we need a button to run the quick pyra test for factory use
  14. # Do we need to ask user if they want sudo access?
  15. # Have wifi setup wizard - Not everyone has used Linux
  16.  
  17. userdata()
  18. {
  19. zenity --forms --title "Create User Account" --text="All Fields are required" \
  20. --add-entry="Full Name" \
  21. --add-entry="User Name" \
  22. --add-entry="Host Name" \
  23. --add-password="Password" \
  24. --add-password="Confirm Password" >> tmp
  25.  
  26. fullname=$(cut -d '|' -f 1 ./tmp)
  27. username=$(cut -d '|' -f 2 ./tmp)
  28. password=$(cut -d '|' -f 4 ./tmp)
  29. password1=$(cut -d '|' -f 5 ./tmp)
  30. rm ./tmp
  31.  
  32. if [[ -z "$fullname"||-z "$username"||-z "$password"||-z "$password1" ]]
  33. then
  34. zenity --title="Error" --error --text="All fields are required" --timeout 6
  35. userdata
  36. elif [ "$password" != "$password1" ]
  37. then
  38. zenity --title="Error" --error --text="Password must match" --timeout 6
  39. userdata
  40. else
  41. echo "$fullname"
  42. echo "$username"
  43. echo "$password"
  44.  
  45. useradd -m --shell /bin/bash -c "$fullname,,," -G sudo,audio,bluetooth,plugdev "$username"
  46. passwd "$username" "$password1"
  47. fi
  48. }
  49.  
  50. hostname()
  51.  
  52.  
  53. encrypt()
  54. {
  55. if zenity --question --title="Encryption" --text="Encrypt home dir ? \n\nIf enabled your home dir will be encrypted with ecryptfs." --ok-label="Yes" --cancel-label="No"; then
  56. modprobe ecryptfs
  57. LOGINPASS=$password ecryptfs-migrate-home -u "$username"
  58. fi
  59. }
  60.  
  61.  
  62. #Main function
  63. main() {
  64.  
  65. # Begin First Run questionaire
  66. zenity --question --title="First Run Wizard" --text="Welcome to Pyra!\n\nThis wizard will help you set up your Pyra handheld for first use.\n\nA few simple questions are asked to help personalise and configure your device.\n\n. Do you wish to begin or Shut down?" --ok-label="Begin" --cancel-label="Shut down"
  67.  
  68. userdata
  69. encrypt
  70. zenity --info --text="The Wizard is now complete\n\nPlease Note your username is "$username"\n\n\n\nThe Pyra will now shutdown to complete initial setup"
  71.  
  72. shutdown now
  73. }
  74. main
Add Comment
Please, Sign In to add comment