Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- export LANG=en_US.UTF-8
- export GTK2_RC_FILES=/usr/share/themes/Xfce/gtk-2.0/gtkrc
- export WALLPAPER=/usr/share/pyra/wallpapers/official/pyra-a-720.png
- #xmodmap /etc/skel/.Xmodmap
- #hsetroot -cover $WALLPAPER
- #XXXX To do
- #Ask user what language they speak, Only problem is: This wizard will be in english to begin with
- # Merge Firstname / Username / hostname / password sections, have password confirm automatically - This would look nicer for the user
- #Ask Firewall and encryption stuff on same page
- # Perhaps we need a button to run the quick pyra test for factory use
- # Do we need to ask user if they want sudo access?
- # Have wifi setup wizard - Not everyone has used Linux
- userdata()
- {
- zenity --forms --title "Create User Account" --text="All Fields are required" \
- --add-entry="Full Name" \
- --add-entry="User Name" \
- --add-entry="Host Name" \
- --add-password="Password" \
- --add-password="Confirm Password" >> tmp
- fullname=$(cut -d '|' -f 1 ./tmp)
- username=$(cut -d '|' -f 2 ./tmp)
- password=$(cut -d '|' -f 4 ./tmp)
- password1=$(cut -d '|' -f 5 ./tmp)
- rm ./tmp
- if [[ -z "$fullname"||-z "$username"||-z "$password"||-z "$password1" ]]
- then
- zenity --title="Error" --error --text="All fields are required" --timeout 6
- userdata
- elif [ "$password" != "$password1" ]
- then
- zenity --title="Error" --error --text="Password must match" --timeout 6
- userdata
- else
- echo "$fullname"
- echo "$username"
- echo "$password"
- useradd -m --shell /bin/bash -c "$fullname,,," -G sudo,audio,bluetooth,plugdev "$username"
- passwd "$username" "$password1"
- fi
- }
- hostname()
- encrypt()
- {
- 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
- modprobe ecryptfs
- LOGINPASS=$password ecryptfs-migrate-home -u "$username"
- fi
- }
- #Main function
- main() {
- # Begin First Run questionaire
- 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"
- userdata
- encrypt
- 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"
- shutdown now
- }
- main
Add Comment
Please, Sign In to add comment