Blog / News

Posted on by Chris

First Mac Server Update No# 1

As many of you may have seen from our home page, we have just release our first Apple Mac Server version of PaperCut NG. About 30 majority Mac sites (mostly in education) expressed an interest in the testing program prior to release, and we’ve had a lot more download and contribute since the public beta release.

A mistyped GCC compiler option caused problems with the 6.2.3472 build on PowerPC based systems. We quickly re-released on Saturday night with this issue addressed.

The feedback so far has been great. Also thanks for all the compliments. Some examples:

“I must say the product is exceptional. I have had no problems whatsoever. “

“The app is great, stable and all the functionality is there. The notifications are working well and the importing of users for OD was very fast. “

One tester suggested that we should update the install process so the “papercut” host user is created automatically upon install. We’ve reworking the postflight install script in the installer so it creates the user in the local NetInfo domain using the dscl tool.

One of the frustrating aspects of using dscl to create the user is that you need to explicitly define the user’s uid (unique ID). How do you determine a free UID on the Mac? I took a look at a few other scripts and program installers. The only examples I could find used hardcoded numbers! I suppose in the hope that they’re not already in use. I decided that the best way was to exec Perl and do a quick scan using getpwuid looking for a free slot. Here is the relevant section in the preflight script:

# Add the host user account if required
if ! `id ${UNIX_USERNAME} >/dev/null 2>/dev/null`; then
    echo "Creating account for ${UNIX_USERNAME}" >> $install_log
    # Find first available UID between 101 and 499.
    #   We should probably try below 100 but I'd like to stay out of the Apple range
    uid=`perl -e '
            my $t = 101;
            while ($t > $install_log
        echo "${msg}" 1>&2
        exit 1
    dscl . create /groups/${UNIX_USERNAME}
    dscl . create /groups/${UNIX_USERNAME} name ${UNIX_USERNAME}
    dscl . create /groups/${UNIX_USERNAME} passwd "*"
    dscl . create /groups/${UNIX_USERNAME} gid ${uid}

    dscl . create /users/${UNIX_USERNAME}
    dscl . create /users/${UNIX_USERNAME} RealName "${APP_NAME} Host User"
    dscl . create /users/${UNIX_USERNAME} UniqueID ${uid}
    dscl . create /users/${UNIX_USERNAME} shell /bin/bash
    dscl . create /users/${UNIX_USERNAME} NFSHomeDirectory "${dest}"
    dscl . create /users/${UNIX_USERNAME} PrimaryGroupID ${uid}


The recommended practice, and the behaviour seen when creating users via System Preferences->Accounts, is for standard users to be created at UID 500 and above. 100 and below are reserved for Mac OS X system and process accounts. I’ve started our search for a UID between 101 and 499 and this should be a pretty safe bet.

We’d like to get some good testing done on this… for example, does it work OK with all systems linking into external user sources such as Open Directory? If you do experience any problems, please let us know. Also note that the code first checks to see if the user exists. This means that advanced administrators who would prefer to create their own papercut host user, can do so prior to the install.

The latest Mac build is 3481. Please keep the feedback coming!

This entry was posted in Releases. Bookmark the permalink.


Blog Categories & Archives