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

47 lines
1.2 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 && type -t su; then
su - -c "git config --global user.email $USER@localhost" "$USER"
su - -c "git config --global user.name 'live builder'" "$USER"
fi >&/dev/null
# 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"
sed -i '/^%_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
# squashfs-tools 4.3+
echo "allowed_mountpoints=/proc" >> /etc/hasher-priv/system
# requisite
hasher-useradd "$USER"