84 lines
1.9 KiB
Bash
Executable file
84 lines
1.9 KiB
Bash
Executable file
#!/bin/sh
|
|
set -x
|
|
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
VERSION=$(date +%Y.%m.%d_%H.%M)
|
|
|
|
BUILD=1
|
|
|
|
ARCH=java
|
|
LIBSUFFIX=$(echo $ARCH | grep -o "\(64\)")
|
|
|
|
TAG=cyco
|
|
TMP=/tmp/$TAG
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
OUTPUT=/tmp
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
|
|
|
|
PREFIX=/usr
|
|
|
|
# Cleaning
|
|
rm -fr $TMP/$PRGNAM-$VERSION
|
|
rm -fr $PKG
|
|
mkdir -p $TMP
|
|
|
|
if [ ! -e $REPOSITORY ] ; then
|
|
mkdir -p $(dirname $REPOSITORY)
|
|
git clone https://github.com/ribomation/DroidAtScreen1.git $REPOSITORY
|
|
else
|
|
( cd $REPOSITORY
|
|
git pull
|
|
)
|
|
fi
|
|
|
|
# Preparation
|
|
cp -R $REPOSITORY $TMP/$PRGNAM-$VERSION
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
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 {} \;
|
|
|
|
# Building
|
|
mvn package
|
|
|
|
# Installation
|
|
VERSION=$(ls target/droidAtScreen-*.jar | grep -o "[0-9.]*.jar" | sed 's|.jar||g')
|
|
|
|
mkdir -p $PKG$PREFIX/doc/$PRGNAM $PKG$PREFIX/{bin/,libexec/}
|
|
mv target/droidAtScreen-$VERSION.jar $PKG$PREFIX/libexec/
|
|
mv README.md $PKG$PREFIX/doc/$PRGNAM
|
|
cat <<EOF > $PKG$PREFIX/bin/$PRGNAM
|
|
#!/bin/sh
|
|
java -jar $PREFIX/libexec/droidAtScreen-$VERSION.jar
|
|
EOF
|
|
|
|
chown -R root:root $PKG
|
|
find $PKG -type f -exec chmod 644 {} \;
|
|
chmod +x $PKG$PREFIX/bin/*
|
|
|
|
# Packaging
|
|
cd $PKG
|
|
mkdir install
|
|
cat <<EOF > install/slack-desc
|
|
$PRGNAM: $PRGNAM (Show the screen of a real Android device on a PC)
|
|
$PRGNAM:
|
|
$PRGNAM: Droid@Screen is a stand-alone Java program that show the device screen of
|
|
$PRGNAM: an Android phone at a computer. It's typically used for demo and training.
|
|
$PRGNAM:
|
|
$PRGNAM: (requires Java)
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: http://blog.ribomation.com/droid-at-screen/
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz
|
|
|