[d4b1a0]: build Maximize Restore History

Download this file

build    150 lines (122 with data), 4.4 kB

#!/bin/sh

rm -r dist
mkdir dist
rm $(find . | grep '~')
locationhere="$(pwd)"

# Extract nsis

if [ ! -e ./winbuild/nsis ]
then
echo "Extracting nsis..."
cd winbuild
tar -jxvf nsis.tar.bz2
cd ..
fi

export WINEPREFIX="$locationhere/winbuild/nsis"
ubnverinit=$(bzr version-info | grep revno | sed 's/revno: //')

# Install prerequisites

listofprereqstivapt="wine fakeroot alien"
for indvprereqstivapt in $listofprereqstivapt
do
if [ "$(whereis $indvprereqstivapt | tr ' ' '\n' | grep bin)" = "" ]
then
echo "Installing $indvprereqstivapt"
sudo apt-get update
sudo apt-get install $indvprereqstivapt
else
echo "Found $indvprereqstivapt"
fi
done

# Backup Wine config files

cp $locationhere/winbuild/nsis/system.reg $locationhere/winbuild/nsis/system.bak
cp $locationhere/winbuild/nsis/user.reg $locationhere/winbuild/nsis/user.bak

# Build for distros

if [ "$1" != "distro" ]
then
targetbuildoslist="$(cat targetdistros)"
echo "Building for all distros in targetdistros file, $targetbuildoslist"
else
if [ "$2" = "" ]
then
echo "You must specify at least one distro to build after the option distro"
exit
fi
targetbuildoslist="$(echo $@ | sed s/distro//)"
echo "Building specified distro $targetbuildoslist"
fi

for targetbuildos in $targetbuildoslist
do
cd $locationhere
ubnver=$targetbuildos\rev$ubnverinit

# sh build

mv ./initkern/ubninit-$targetbuildos ./unetbootin/ubninit
mv ./initkern/ubnkern-$targetbuildos ./unetbootin/ubnkern
cp ./unetbootin/ubninst ./unetbootin/ubninst-orig
sed -i "s/replacewithubnversion/$ubnver/g" ./unetbootin/ubninst

# sh override
if [ -e ./override/$targetbuildos ]
then
./override/$targetbuildos ./unetbootin/ubninst
fi

cd $locationhere/makeself
./makeself.sh $locationhere/unetbootin $locationhere/dist/unetbootin-$ubnver.sh "UNetbootin" ./ubninst
cd $locationhere
mv ./unetbootin/ubninst-orig ./unetbootin/ubninst

# deb build

mv $locationhere/unetbootin/ubnkern $locationhere/unetbootin-deb/boot/ubnkern
mv $locationhere/unetbootin/ubninit $locationhere/unetbootin-deb/boot/ubninit
cp ./unetbootin-deb/DEBIAN/postinst ./unetbootin-deb/DEBIAN/postinst-orig
sed -i "s/replacewithubnversion/$ubnver/g" ./unetbootin-deb/DEBIAN/postinst

# deb and rpm override
if [ -e ./override/$targetbuildos ]
then
./override/$targetbuildos ./unetbootin-deb/DEBIAN/postinst
fi

cp ./unetbootin-deb/DEBIAN/control ./unetbootin-deb/DEBIAN/control.bak
sed -i "s/Version: 1.0/Version: $ubnver/" ./unetbootin-deb/DEBIAN/control
ubnsize=$(du -ck unetbootin-deb | grep total | sed "s/ /\n/g" | sed "s/\t/\n/g" | head --lines 1)
sed -i "s/Installed-Size: 10/Installed-Size: $ubnsize/" ./unetbootin-deb/DEBIAN/control
dpkg-deb -b unetbootin-deb
mv ./unetbootin-deb.deb ./dist/unetbootin_$ubnver\_all.deb
mv ./unetbootin-deb/DEBIAN/control.bak ./unetbootin-deb/DEBIAN/control
mv ./unetbootin-deb/DEBIAN/postinst-orig ./unetbootin-deb/DEBIAN/postinst
mv $locationhere/unetbootin-deb/boot/ubnkern $locationhere/winbuild/ubnkern
mv $locationhere/unetbootin-deb/boot/ubninit $locationhere/winbuild/ubninit

# rpm build

cd $locationhere/dist
fakeroot alien --scripts -r unetbootin_$ubnver\_all.deb

# exe build

cd $locationhere/winbuild
cp unetbootin.nsi unetbootin-orig.nsi
cp vbcdedit.bat vbcdedit-orig.bat
cp config.sup config-orig.sup
cp menu.lst menu-orig.lst
sed -i "s/ubnbzrsubversionum/$ubnverinit/g" ./unetbootin.nsi
sed -i "s/replacewithubnversion/$ubnver/g" ./unetbootin.nsi
sed -i "s/replacewithubnversion/$ubnver/g" ./vbcdedit.bat
sed -i "s/replacewithubnversion/$ubnver/g" ./config.sup
sed -i "s/replacewithubnversion/$ubnver/g" ./menu.lst
cd ..

# exe override
if [ -e ./override/$targetbuildos ]
then
./override/$targetbuildos ./winbuild/menu.lst
fi

cd $locationhere/winbuild
wine "C:\Program Files\NSIS\makensis.exe" unetbootin.nsi
mv setup.exe $locationhere/dist/unetbootin-$ubnver.exe
mv unetbootin-orig.nsi unetbootin.nsi
mv vbcdedit-orig.bat vbcdedit.bat
mv config-orig.sup config.sup
mv menu-orig.lst menu.lst
if [ -e ./dtkernlc-orig.bat ]
then
mv dtkernlc-orig.bat dtkernlc.bat
fi
cd $locationhere
mv $locationhere/winbuild/ubnkern $locationhere/initkern/ubnkern-$targetbuildos
mv $locationhere/winbuild/ubninit $locationhere/initkern/ubninit-$targetbuildos
done

# Restore Wine config files

sleep 5
mv $locationhere/winbuild/nsis/system.bak $locationhere/winbuild/nsis/system.reg
mv $locationhere/winbuild/nsis/user.bak $locationhere/winbuild/nsis/user.reg