Home Forums Software InstaDMG help with my instauser script

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #371957
    knowmad
    Participant

    Long since having given up any sort of pride, I am now asking questions on everything that does not work, as long as I have honestly tried to fix it…. so…..

    This is my script (password changed to protect ME):

    [code]#!/bin/bash

    # This script will create a canned user.
    # admin POC
    # Josh Wisenbaker 7/13/2007 on my ass at SFO

    #Make the account
    /usr/bin/dscl . -create Users/admin
    /usr/bin/dscl . -create Users/admin home /var/admin
    /usr/bin/dscl . -create Users/admin shell /bin/bash
    /usr/bin/dscl . -create Users/admin uid 11
    /usr/bin/dscl . -create Users/admin gid 11
    /usr/bin/dscl . -create Users/admin realname “Administrator”
    /usr/bin/dscl . -create Groups/admin
    /usr/bin/dscl . -create Groups/admin gid 11
    /usr/bin/dscl . -passwd Users/admin “password”
    /usr/sbin/dseditgroup -o edit -a admin -t user -n /NetInfo/DefaultLocalNode admin

    #Make the home

    /usr/bin/ditto /System/Library/User\ Template/English.lproj/ /var/admin
    /usr/sbin/chown -R admin:admin /var/admin

    #Configure ARD
    /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu

    #Hide Admin User
    /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool YES

    exit 0
    [/code]

    and this is the result:

    The new image boots up fine, though it takes a very long time to go from boot screen to login window. It gets to log in window without running the lovely apple welcome script, but then I cannot login. I looked it over and as far as I can tell it is not creating the user/home folder. I am running the instauser script by replacing the original with mine in the file hierarchy and re-building the package using the existing PackageMaker Project. Just to double check I did this using the original script (no changes, just a build) and it worked flawlessly when run as a custom package.
    What am I doing wrong?

    For the heck of it I ran the script above on my test build machine under sudo and it did indeed create the user and the home drive and let me log in, and hise the home drive.

    Once we figure out what is wrong here, I have questions about making this run on the unmounted image using the changes made in post [url]https://www.afp548.com/forum/viewtopic.php?showtopic=19941[/url] … and how much of the other stuff I am doing can be done then too?

    but thats all for another post.

    (so much to learn so little time)

    #371990
    Patrick Fergus
    Participant

    Are you running this as a StartupItem? I think the only reason to handle it that way is if you’re running it in Tiger. I see the reference to NetInfo in your script–if you’re running Leopard, that won’t work.

    What happens if you make the home /Users/admin?

    You also lack a line in your script to nuke the StartupItem, if you are indeed using it. Something like this:

    [code]/usr/bin/srm -r /Library/StartupItems/instauser[/code]

    before “exit 0”. Also, not being 100% familiar with PackageMaker, are you sure you’re tweaking the right source file? I [i]think[/i] it’s in the “Archive” folder.

    #371993
    knowmad
    Participant

    Ok, so I need to add more details….
    I am running this as a startup item, I really thought that was how it is supposed to run, how else would you run it?
    I am running it on leopard,I also thought the Netinfo reference was odd, but I took it as part of the script that I do not understand and did not remove it, i will.
    How would you run it if not as a startup item, assuming your running this on leopard and you don’t want to use the ‘copy’ system for setting up new users (ie the 10.5 specific version of the script)?

    Mostly I have been trying (admittedly only after I wrote this post) to use the DSCL -f version and do it NOT as a startup script….. but that has password issues all its own….
    (Edit below this line, forgot to add)
    Yes, the part that is necessary to ‘tweak’ is in the archive section, rather than mess with it in the existing package, I used the packagemaker project that is included to rebuild it with my script replacing the original.
    That part seems to work fine.

    #372001
    Patrick Fergus
    Participant

    If you’re using Leopard, see “Instauser 10.5” at the root of the InstaDMG 1.3b distribution. The Read Me says:

    “This 10.5 package does everything with file copies. The dslocal system of Leopard makes this possible. There is still a startup item in place to populate the home folder. More than anything this is here as an example of a startup item.”

    Instauser 10.5 copies the files created by dscl into the appropriate locations in Leopard’s dslocal directory. You create:

    – “admin”‘s user record
    – The admin group

    and install those in the right places. Ditto the user template into wherever you set “admin”‘s home to be and you should be ready to go. If you’re unfamiliar with what each of the files does in Instauser 10.5, see my post dated Wednesday, March 05 2008 @ 05:17 pm CST here:

    [url]https://www.afp548.com/forum/viewtopic.php?forum=45&showtopic=19893[/url]

    – Patrick

    #372002
    knowmad
    Participant

    No, I am fully familiar with how instauser 10.5 works…. i just (for reasons I am not fully capable of voicing) don’t prefer that method….
    I think I will end up with the combination of dscl -f and placed hash file.

    #372443
    ewhite
    Participant

    Maybe this is obvious, but it isn’t clear to me from the Read Me … to implement Instauser 10.5, is it as simple as putting Instauser_10.5.pkg into the CustomPKG folder?

    #372444
    knowmad
    Participant

    [QUOTE][u]Quote by: ewhite[/u][p]Maybe this is obvious, but it isn’t clear to me from the Read Me … to implement Instauser 10.5, is it as simple as putting Instauser_10.5.pkg into the CustomPKG folder?[/p][/QUOTE]

    really, your much better off using the other user creation script found in this thread:
    [url]https://www.afp548.com/forum/viewtopic.php?showtopic=20206[/url]

    #372445
    ewhite
    Participant

    [QUOTE][u]Quote by: knowmad[/u][p]
    really, your much better off using the other user creation script found in this thread:
    [url]https://www.afp548.com/forum/viewtopic.php?showtopic=20206[/url]
    [/p][/QUOTE]

    I’ll try that, thank you!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Comments are closed