I'm trying to work out the kinks for this RPM I'm trying to create. Basically, I'm trying to make it so that if
mark does not exist on the system, I want to create a mark user account. I've got this in a
%pre block in my .spec file:
id mark &>/dev/null if [ "$?" != "0" ]; then echo "Adding 'mark' user..." useradd -g $GROUP_ID \ -s /bin/bash -d mark fi
Now, after I build the RPM and run
rpm -ivh iPackage-1.0.0-1.noarch.rpm, I check the output and see "Adding 'mark' user...", but when I run
id mark on the command line, I get
id: mark: No such user. Also,
/etc/passwd doesn't have a mark account, either. Any ideas?
Edit: See my answer. Turns out, the variables need to be defined.