summaryrefslogtreecommitdiff
path: root/prepare_stage1_repo.sh
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-01-27 21:36:39 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-01-27 21:36:39 +0100
commit54ebd1dea1dd4ad68d28e27f7a20ce843f1d2f59 (patch)
treea443d2726ef379fd281bffe6141f1f6321ab8681 /prepare_stage1_repo.sh
parentd81584556c99356f42d30c87f9b87989f7653987 (diff)
downloadbootstrap32-54ebd1dea1dd4ad68d28e27f7a20ce843f1d2f59.tar.xz
added more variables and cleaned up phase 1
Diffstat (limited to 'prepare_stage1_repo.sh')
-rwxr-xr-xprepare_stage1_repo.sh38
1 files changed, 23 insertions, 15 deletions
diff --git a/prepare_stage1_repo.sh b/prepare_stage1_repo.sh
index 882c431..b93635d 100755
--- a/prepare_stage1_repo.sh
+++ b/prepare_stage1_repo.sh
@@ -2,13 +2,9 @@
. "./default.conf"
-set -x
-
# prepare the i486-chroot for stage 1
# prepare pacman in i486-chroot
-sudo rm -rf $STAGE1_CHROOT
-
if test ! -d $STAGE1_CHROOT; then
# create and initialize a new i486 chroot in $STAGE1_CHROOT
@@ -61,28 +57,40 @@ EOF
sudo pacman --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syyu
pacman --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Q
+fi
- # prepare the build enviroment
+if test ! -d $STAGE1_BUILD; then
- mkdir $HOME/build
- cd $HOME/build
+ # prepare the build enviroment
+
+ mkdir $STAGE1_BUILD
+ cd $STAGE1_BUILD
# prepare makepkg for building into the i486-chroot
-
- cp /usr/bin/makepkg $HOME/build/makepkg-i486
+ cp /usr/bin/makepkg $STAGE1_BUILD/makepkg-i486
# patch run_pacman in makepkg, we cannot pass the pacman root to it as parameter ATM
+
sed -i "s@\"\$PACMAN_PATH\"@\"\$PACMAN_PATH\" --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT@" makepkg-i486
+ # prepare a configuration for building the packages with makepkg
+ # fitting to the destination architecture
+
cp /etc/makepkg.conf makepkg-i486.conf
- sed -i 's@^CARCH=.*@CARCH="i486"@' makepkg-i486.conf
- sed -i 's@^CHOST=.*@CHOST="i486-unknown-linux-gnu"@' makepkg-i486.conf
- sed -i 's@^#MAKEFLAGS=.*@MAKEFLAGS="-j20"@' makepkg-i486.conf
- sed -i 's@-march=x86-64 -mtune=generic @@' makepkg-i486.conf
+ sed -i "s@^CARCH=.*@CARCH=\"i486\"@" makepkg-i486.conf
+ sed -i "s@^CHOST=.*@CHOST=\"${TARGET_ARCH}\"@" makepkg-i486.conf
+ CPUS=$(nproc)
+ sed -i "s@^#MAKEFLAGS=.*@MAKEFLAGS=\"-j$CPUS\"@" makepkg-i486.conf
+ sed -i "s@-march=x86-64 -mtune=generic @-march=i486 @" makepkg-i486.conf
echo "Prepared the stage 1 build environment."
-
fi
+if test ! -d $CROSS_HOME/packages32; then
+
+ # get packages repo from Archlinux32 for the diffs
-
+ git clone git@github.com:archlinux32/packages.git $CROSS_HOME/packages32
+
+ echo "Fetched Archlinux32 diffs for packages."
+fi