Various fixes for recent pacman with new book

- add createfiles instructions of packageManager.xml for new book too
- remove unneeded chown when installing pacman (not needed thanks to
  the above)
- Use a dedicated user "builder" for running makepkg: user "tester" is 
  removed at the end of chapter 8, but is needed in following chapters.
This commit is contained in:
Pierre Labastie 2020-07-07 15:27:54 +00:00
parent b6e981a9a3
commit 3484658167
3 changed files with 16 additions and 13 deletions

View file

@ -172,9 +172,7 @@ otherwise it is in /bin.-->
]//userinput" ]//userinput"
mode="pkgmngt"/> mode="pkgmngt"/>
</xsl:if> </xsl:if>
<xsl:if test="contains(@id,'createfiles') <xsl:if test="contains(@id,'createfiles') and $pkgmngt='y'">
and $pkgmngt='y'
and $bashdir='/tools'">
<xsl:apply-templates <xsl:apply-templates
select="document('packageManager.xml')//sect1[ select="document('packageManager.xml')//sect1[
@id='ch-pkgmngt-createfiles' @id='ch-pkgmngt-createfiles'

View file

@ -33,10 +33,10 @@ rm -fv ./usr/share/info/dir # recommended since this directory is already there
# Right now, we have the files in the current directory. They should be moved # Right now, we have the files in the current directory. They should be moved
# to /sources/$PACKAGE/src. # to /sources/$PACKAGE/src.
mkdir -p ../$PACKAGE/src mkdir -p ../$PACKAGE/src
# We'll build as user tester. We need this directory to be owned by that user. # We'll build as user builder. We need this directory to be owned by that user.
chown -R tester ../$PACKAGE chown -R builder ../$PACKAGE
mv * ../$PACKAGE/src mv * ../$PACKAGE/src
chown -R tester $PKG_DEST chown -R builder $PKG_DEST
chmod -R o+r ../$PACKAGE chmod -R o+r ../$PACKAGE
cat > PKGBUILD <<EOF cat > PKGBUILD <<EOF
@ -51,7 +51,7 @@ cp -a * \$pkgdir
} }
EOF EOF
# Building the binary package # Building the binary package
su tester -c"PATH=$PATH; makepkg -c --skipinteg" || true su builder -c"PATH=$PATH; makepkg -c --skipinteg" || true
# Installing it on LFS # Installing it on LFS
if ! pacman -U --noconfirm /var/lib/packages/$ARCHIVE_NAME; then if ! pacman -U --noconfirm /var/lib/packages/$ARCHIVE_NAME; then
pacman -U --noconfirm --overwrite '*' /var/lib/packages/$ARCHIVE_NAME pacman -U --noconfirm --overwrite '*' /var/lib/packages/$ARCHIVE_NAME

View file

@ -497,8 +497,7 @@ CacheDir = /var/cache/pacman/pkg/
LogFile = /var/log/pacman.log LogFile = /var/log/pacman.log
SigLevel = Never SigLevel = Never
# Repository: do not add one now: repo-add needs openssl. # Repository: do not add one now: repo-add needs openssl.
EOF EOF</userinput></screen>
chown tester:tester /var/lib/{packages,pacman}</userinput></screen>
</sect2> </sect2>
@ -550,11 +549,17 @@ following line -->
<title>Creating Essential Files</title> <title>Creating Essential Files</title>
<screen><userinput>if ! grep -q tester /etc/passwd; then <screen><userinput>if ! grep -q tester /etc/passwd; then
echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd echo "builder:x:101:101::/home/builder:/bin/bash" >> /etc/passwd
echo "tester:x:101:" >> /etc/group echo "builder:x:101:" >> /etc/group
install -o tester -d /home/tester install -o builder -d /home/builder
else
TEST_UID=$(grep tester /etc/passwd | cut -d: -f3)
TEST_GID=$(grep tester /etc/group | cut -d: -f3)
echo "builder:x:$((TEST_UID+1)):$((TEST_GID+1))::/home/builder:/bin/bash" >> /etc/passwd
echo "builder:x:$((TEST_GID+1)):" >> /etc/group
install -o builder -d /home/builder
fi fi
chown tester:tester /var/lib/{packages,pacman}</userinput></screen> chown builder:builder /var/lib/{packages,pacman}</userinput></screen>
</sect1> </sect1>