If you're going to create a script that is going to execute /scripts/createacct you'll notice that the createacct script asks you questions that require you to interact with it. The following ENV will stop createacct from asking you questions.
PKGRESTORE=1 /scripts/createacct