haiku/3rdparty/pulkomandy/unbootstrap.sh
Alexander von Gluck IV 52f7c93894 3rdparty/pulkomandy: Fix rm on unbootstrap script
Change-Id: I8c58195906e426971dc1ebd9ae2da23cfa6159c8
2022-03-28 19:38:38 -05:00

37 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Convert _bootstrap packages to non-bootstrap version.
# THIS IS A HACK. The _bootstrap packages are cross-compiled on a pseudo-haiku
# environment running on a different host system. Expect binary
# incompatibilities when trying to use them. However, the development files
# should still be valid, allowing us to build a non-bootstrap Haiku against
# these package before we can get the bootstrap image to run reliably enough
# to actually bootstrap the packages.
mkdir -p work
cd work
for package in ../packages/*.hpkg
do
echo --- Processing $package ---
echo Cleaning work directory...
rm -rf *
echo Extracting package...
package extract $package
echo Converting .PackageInfo...
sed -i .PackageInfo -e s/_bootstrap//g
name=`basename $package|sed -e s/_bootstrap//g`
# If this is a source package, we need to correct the source directory.
if [[ $name = *"-source.hpkg" ]]; then
oldpkgname=$(basename $package | sed -e s/-source.hpkg//g | sed -e s/_source//g)
newpkgname=$(echo $name | sed -e s/-source.hpkg//g | sed -e s/_source//g)
if [[ -d develop/sources/$oldpkgname ]]; then
echo "Fixing source directory..."
mv develop/sources/$oldpkgname develop/sources/$newpkgname;
else
echo "WARN: Want to fix source directory, but develop/sources/$oldpkgname missing!"
fi
fi
echo Regenerating package...
package create ../$name
done