mkimage-profiles/features.in/dev/live/image-scripts.d/40-hasher

45 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh -efu
# configure hasher (implies that 30-users has been run already)
# predefined passwordless livecd user
USER="altlinux"
if ! id "$USER" >&/dev/null; then
echo "No such user '$USER'" >&2
exit
fi
# ~
HOME="/home/$USER"
install -dm750 -o "$USER" -g "$USER" "$HOME"
# we honestly don't know much more
if type -t git >&/dev/null; then
su - -c "git config --global user.email $USER@localhost" "$USER"
su - -c "git config --global user.name 'live builder'" "$USER"
fi
# developer should feel comfortable, eh? ;-)
ZSHELL="/bin/zsh"
if [ -x "$ZSHELL" ]; then
chsh -s "$ZSHELL" "$USER"
install -m755 -o "$USER" -g "$USER" /dev/null "$HOME/.zshrc"
echo "mkdir -p \"\$TMP/hasher\"" >> "$HOME/.zshrc"
fi
# $TMP
TMP="/tmp/.private/$USER"
control pam_mktemp enabled
subst '/^%_tmppath.*tmp$/d' "$HOME/.rpmmacros"
echo "%_tmppath $TMP" >> "$HOME/.rpmmacros"
# ~/hasher
WORKDIR="$TMP/hasher"
ln -s "$TMP/hasher" "$HOME/hasher"
# online repo needs network not isolation
echo "export share_network=1" >> /etc/profile.d/hasher.sh
chmod +x /etc/profile.d/hasher.sh
# requisite
hasher-useradd "$USER"