-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslacker.SlackBuild
More file actions
103 lines (86 loc) · 3.17 KB
/
Copy pathslacker.SlackBuild
File metadata and controls
103 lines (86 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Slackware build script for slacker
# This SlackBuild builds the master branch.
# It is not suggested to use it; it is not a stable and proper SlackBuild.
#
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=slacker
VERSION=${VERSION:-0.9.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_FRG}
PKGTYPE=${PKGTYPE:-txz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i686 ;;
arm*) export ARCH=arm ;;
*) export ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/FORGE}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=pentium4 -mtune=generic"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -march=x86-64 -mtune=generic -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
# Pick the right example configs for the running release (stable vs -current).
DIR=stable
grep -q '^VERSION_CODENAME=current$' /etc/os-release && DIR=current
set -e
rm -rf $PKG $TMP
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
cp -R $CWD/* .
rm -rf target || true
chown -R root:root .
find . -type f \( -perm -4000 -o -perm -2000 \) -exec chmod -s {} +
find . ! -type l -type d ! -perm 755 -exec chmod -f 755 {} +
find . ! -type l -type f -perm /111 ! -perm 755 -exec chmod -f 755 {} +
find . ! -type l -type f ! -perm /111 ! -perm 644 -exec chmod -f 644 {} +
# online + debug is what we need for developing.
# NOTE: SLKCFLAGS only affect any C built by build scripts; the Rust code itself
# is compiled by rustc for the host arch (i686 / x86_64) automatically.
# Build ONCE: cargo-auditable embeds an SBOM and is a superset of `cargo build`,
# so use it when present, otherwise fall back to a plain build (no double build).
if command -v cargo-auditable >/dev/null 2>&1; then
CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" cargo auditable build --release
else
CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" cargo build --release
fi
# run tests
cargo test
mkdir -p $PKG/usr/local/sbin
install -m0755 target/release/slacker $PKG/usr/local/sbin/slacker
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# docs
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples
install -m0644 README.md NEWS $PKG/usr/doc/$PRGNAM-$VERSION/
install -m0644 examples/etc-slacker/"$DIR"/"$ARCH"/* $PKG/usr/doc/$PRGNAM-$VERSION/examples/
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/etc/slacker/templates
for f in slacker.conf distro-upgrade.conf mirrors repos blacklist; do
install -m0644 examples/etc-slacker/"$DIR"/"$ARCH"/$f $PKG/etc/slacker/$f.new
done
chmod 644 $PKG/etc/slacker/*.new
# man page
mkdir -p $PKG/usr/man/man8
install -m0644 man/slacker.8 $PKG/usr/man/man8/slacker.8
gzip -9 $PKG/usr/man/man8/slacker.8
# Copy the slack-desc and a custom doinst.sh
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
#sleep 1
#gpg --detach-sign --armor $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE