slackbuilds/xap/android-x86/SlackBuild

103 lines
2.3 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
2018-02-10 12:59:27 +01:00
CWD=$(pwd)
PRGNAM=$(basename $CWD)
2020-04-04 16:15:38 +02:00
VERSION=${VERSION:-9.0-r2}
2018-02-10 12:59:27 +01:00
BUILD=1
2020-06-25 11:23:11 +02:00
TAG=gwh
2018-02-10 12:59:27 +01:00
ARCH=$(uname -m)
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
2022-01-22 19:52:02 +01:00
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
mkdir -p $REPOSITORY
2018-02-10 12:59:27 +01:00
mkdir -p $TMP
# Cleaning
rm -fr $PRGNAM $PKG
# Fetching binaries
[ ! -e $REPOSITORY/${PRGNAM}-${VERSION}.${ARCH}.rpm ] && wget -c https://osdn.net/dl/android-x86/android-x86-${VERSION}.x86_64.rpm -O $REPOSITORY/${PRGNAM}-${VERSION}.${ARCH}.rpm
2018-02-10 12:59:27 +01:00
# Installation
mkdir -p $PKG$PREFIX/share/
cd $PKG$PREFIX/share/
rpm2targz $REPOSITORY/${PRGNAM}-${VERSION}.${ARCH}.rpm
2018-02-10 12:59:27 +01:00
tar xvf ${PRGNAM}-${VERSION}.${ARCH}.tar.gz
rm ${PRGNAM}-${VERSION}.${ARCH}.tar.gz
rm -fr usr
mv android-${VERSION} ${PRGNAM}
mkdir -p $PKG$PREFIX/bin/
2022-01-21 17:50:45 +01:00
cp $CWD/${PRGNAM}.sh $PKG$PREFIX/bin/
2018-02-10 12:59:27 +01:00
chmod 755 $PKG$PREFIX/bin/${PRGNAM}.sh
mkdir -p $PKG$PREFIX/share/${PRGNAM}
cat <<EOF > $PKG$PREFIX/share/${PRGNAM}/create-data-img.sh
2021-06-15 10:26:26 +02:00
#!/bin/bash
2018-02-10 12:59:27 +01:00
SIZE=\${SIZE:-128G}
mkdir -p \$HOME/.android-x86
2019-01-20 20:29:05 +01:00
qemu-img create -f qcow2 \$HOME/.android-x86/data.img \$SIZE
2018-02-10 12:59:27 +01:00
EOF
cat <<EOF > $PKG$PREFIX/share/${PRGNAM}/create-data-dir.sh
2021-06-15 10:26:26 +02:00
#!/bin/bash
2018-02-10 12:59:27 +01:00
mkdir -p \$HOME/.android-x86/data
EOF
cat <<EOF > $PKG$PREFIX/share/${PRGNAM}/mount-data-img.sh
2021-06-15 10:26:26 +02:00
#!/bin/bash
sudo modprobe nbd max_part=63
sudo qemu-nbd -c /dev/nbd0 \$HOME/.android-x86/data.img
sudo mkdir -p /media/android-x86-data
sudo mount /dev/nbd0 /media/android-x86-data
EOF
cat <<EOF > $PKG$PREFIX/share/${PRGNAM}/umount-data-img.sh
2021-06-15 10:26:26 +02:00
#!/bin/bash
sudo umount /media/android-x86-data
EOF
chmod 755 $PKG$PREFIX/share/${PRGNAM}/*.sh
2018-02-10 12:59:27 +01:00
# Cleaning
cd $PKG
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Packaging
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (Run Android in QEMU)
$PRGNAM:
$PRGNAM:
$PRGNAM:
2019-04-27 16:25:14 +02:00
$PRGNAM: Host:
$PRGNAM: qemu-img create -f qcow2 $HOME/.android-x86/data.img 128G
$PRGNAM: Guest:
$PRGNAM: # mke2fs -t ext4 -j -L DATA /dev/block/vdc
2018-02-10 12:59:27 +01:00
$PRGNAM:
$PRGNAM: http://www.android-x86.org/
$PRGNAM:
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2020-07-12 09:22:26 +02:00
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz