152 lines
3.6 KiB
Bash
Executable file
152 lines
3.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# variables
|
|
GITHUB_REPO=qtile/qtile
|
|
VERSION=${VERSION:-latest}
|
|
|
|
BUILD=1
|
|
|
|
TAG=gwh
|
|
OUTPUT=/tmp
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
ARCH=$(uname -m)
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
|
|
PREFIX=/usr
|
|
|
|
# nettoyage préalable
|
|
rm -fr $PKG $TMP/$PRGNAM
|
|
|
|
mkdir -p $PKG
|
|
|
|
# mise en place
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO} $REPOSITORY
|
|
cd $REPOSITORY
|
|
git pull --all
|
|
|
|
cp -R $REPOSITORY $TMP/
|
|
cd $TMP/$PRGNAM/
|
|
|
|
[ "x$VERSION" == "xlatest" ] && VERSION=$(git describe --tags --abbrev=0)
|
|
[ "x$VERSION" == "x" ] && VERSION=trunk
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
|
|
|
|
# installation
|
|
python3 ./setup.py install --root=$PKG
|
|
|
|
cat <<EOF > $PKG$PREFIX/bin/start_qtile.sh
|
|
#!/bin/bash
|
|
|
|
#set -e
|
|
|
|
LOGFILE=~/.wsession-errors
|
|
true > \$LOGFILE
|
|
exec &> \$LOGFILE
|
|
|
|
set -x
|
|
echo "sway Starting: \$( date )"
|
|
|
|
# Uncomment if mouse pointer is invisible
|
|
#export WLR_NO_HARDWARE_CURSORS=1
|
|
|
|
unset QT_QPA_PLATFORM
|
|
|
|
export QT_QPA_PLATFORMTHEME=qt5ct
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
export XDG_PICTURES_DIR=~/.wallpapers
|
|
|
|
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-\$(id -u)
|
|
|
|
mkdir -p \$XDG_RUNTIME_DIR
|
|
chmod 0700 \$XDG_RUNTIME_DIR
|
|
|
|
# avoid wlr error
|
|
unset DISPLAY
|
|
|
|
exec dbus-run-session qtile start -b wayland
|
|
EOF
|
|
chmod +x $PKG$PREFIX/bin/start_qtile.sh
|
|
|
|
mkdir -p $PKG$PREFIX/share/wayland-sessions/
|
|
cp resources/qtile-wayland.desktop $PKG$PREFIX/share/wayland-sessions/
|
|
|
|
mkdir -p $PKG$PREFIX/share/xsessions/
|
|
cp resources/qtile.desktop $PKG$PREFIX/share/xsessions/
|
|
mkdir -p $PKG/etc/X11/xinit/
|
|
cat <<EOF > $PKG/etc/X11/xinit/xinitrc.$PRGNAM
|
|
#!/bin/sh
|
|
|
|
userresources=\$HOME/.Xresources
|
|
usermodmap=\$HOME/.Xmodmap
|
|
sysresources=/etc/X11/xinit/.Xresources
|
|
sysmodmap=/etc/X11/xinit/.Xmodmap
|
|
|
|
# Merge in defaults and keymaps
|
|
if [ -f \$sysresources ]; then
|
|
xrdb -merge \$sysresources
|
|
fi
|
|
|
|
if [ -f \$sysmodmap ]; then
|
|
xmodmap \$sysmodmap
|
|
fi
|
|
|
|
if [ -f \$userresources ]; then
|
|
xrdb -merge \$userresources
|
|
fi
|
|
|
|
if [ -f \$usermodmap ]; then
|
|
xmodmap \$usermodmap
|
|
fi
|
|
|
|
# Start qtile
|
|
if [ -z "\$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
|
|
exec ck-launch-session dbus-launch --exit-with-session qtile start
|
|
else
|
|
exec dbus-launch --exit-with-session qtile start
|
|
fi
|
|
EOF
|
|
|
|
sed -i 's|Exec=qtile start -b wayland|Exec=/usr/bin/start_qtile.sh|' $PKG$PREFIX/share/wayland-sessions/qtile-wayland.desktop
|
|
|
|
mkdir -p $PKG$PREFIX/doc/$PRGNAM
|
|
cp LICENSE *.md $PKG$PREFIX/doc/$PRGNAM/
|
|
|
|
# correction
|
|
cd $PKG
|
|
chown -R root:root *
|
|
[ -d $PKG$PREFIX/man ] && find $PKG$PREFIX/man -name "*.?" -type f -exec gzip -9 {} \;
|
|
|
|
# embaumement
|
|
mkdir -p $PKG/install
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
# HOW TO EDIT THIS FILE:
|
|
# The "handy ruler" below makes it easier to edit a package description. Line
|
|
# up the first '|' above the ':' following the base package name, and the '|'
|
|
# on the right side marks the last column you can put a character in. You must
|
|
# make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':'.
|
|
|
|
|-----handy-ruler------------------------------------------------------|
|
|
$PRGNAM: $PRGNAM (A tiling window manager written and configured in Python)
|
|
$PRGNAM:
|
|
$PRGNAM: A full-featured, hackable tiling window manager written and
|
|
$PRGNAM: configured in Python
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: https://qtile.org
|
|
EOF
|
|
|
|
# empaquetage
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|