Commit 9907a70f authored by Leon's avatar Leon 🎵
Browse files

Reverting the single-user thing

parent 34104218
Pipeline #11587 skipped with stage
# Maintainer: leonekmi <usingarchbtw@leonekmi.fr>
pkgname=karaokemugen-git
pkgver=3.2.0.r0.g9ecde13e
pkgver=3.2.2.r1.g029d4a0f
pkgrel=1
pkgdesc="Karaoke playlist manager/player app used in parties or events."
arch=('any')
url="https://mugen.karaokes.moe/"
license=('MIT')
groups=()
depends=('mpv' 'ffmpeg' 'postgresql' 'electron')
depends=('mpv' 'ffmpeg' 'postgresql' 'electron') # Warning : to be replaced with electron8 when Electron 9 will be pushed to [community]
makedepends=('git' 'npm' 'typescript' 'yarn' 'nodejs>=12')
optdepends=('sudo: for using karaokemugen-install script')
provides=("${pkgname%-git}")
......@@ -23,20 +23,16 @@ source=('karaokemugen::git+https://lab.shelter.moe/karaokemugen/karaokemugen-app
'database-tweak.diff'
'database.json'
'icon256.png'
'karaokemugen.desktop'
'10-mugensudo'
'payload.sh')
'karaokemugen.desktop')
noextract=()
md5sums=('SKIP'
'SKIP'
'7640e20425422b5cd146acbb51110ea6'
'7f27a04c232e38ad6e070e742b0a2dda'
'4ef507422d745a1022580642b0441e77'
'8c3893966137caecf0a56c57aac5b559'
'c1807f76ea2d800999910fe66e56fe73'
'0f887855e641ec949ce7c6b69d79ad1e'
'5e9a33a42fef7572b7e0fa504c586f32'
'10561eed906a5efeed427f90501b4f49'
'7304bcf403613a276dba896ba2d2a918'
'6a0c5042def68d0eaffc2cc87cd11462')
'10561eed906a5efeed427f90501b4f49')
# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for
# a description of each element in the source array.
......@@ -81,32 +77,25 @@ package() {
cd "$srcdir/${pkgname%-git}"
# Application itself
install -dm775 "$pkgdir/opt/${pkgname%-git}"
cp -r --no-preserve=ownership,mode packages/linux-unpacked/* "$pkgdir/opt/${pkgname%-git}/"
install -dm775 "$pkgdir/opt/${pkgname%-git}/app"
touch "$pkgdir/opt/${pkgname%-git}/portable"
chmod -R 775 "$pkgdir/opt/${pkgname%-git}/"
install -dm755 "$pkgdir/usr/lib/${pkgname%-git}"
cp -dr --no-preserve=ownership packages/linux-unpacked/resources/* "$pkgdir/usr/lib/${pkgname%-git}/"
chmod -R 755 "$pkgdir/usr/lib/${pkgname%-git}/"
# Symlinks for configuration
install -dm775 "$pkgdir/etc/${pkgname%-git}"
cp "config.sample.yml" "$pkgdir/opt/${pkgname%-git}/app/config.sample.yml"
cp "$srcdir/database.json" "$pkgdir/opt/${pkgname%-git}/app/database.json"
ln -s "$pkgdir/opt/${pkgname%-git}/app/database.json" "$pkgdir/etc/${pkgname%-git}/database.json"
ln -s "$pkgdir/opt/${pkgname%-git}/app/config.yml" "$pkgdir/etc/${pkgname%-git}/config.yml"
# install -dm775 "$pkgdir/etc/${pkgname%-git}"
# cp "config.sample.yml" "$pkgdir/opt/${pkgname%-git}/app/config.sample.yml"
# cp "$srcdir/database.json" "$pkgdir/opt/${pkgname%-git}/app/database.json"
# ln -s "$pkgdir/opt/${pkgname%-git}/app/database.json" "$pkgdir/etc/${pkgname%-git}/database.json"
# ln -s "$pkgdir/opt/${pkgname%-git}/app/config.yml" "$pkgdir/etc/${pkgname%-git}/config.yml"
# License
install -dm755 "$pkgdir/usr/share/licenses/${pkgname%-git}"
install -m644 LICENSE.md "$pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE"
# sudo rule
install -dm750 "$pkgdir/etc/sudoers.d"
install -m440 "$srcdir/10-mugensudo" "$pkgdir/etc/sudoers.d/10-mugensudo"
# Runtimes
install -dm755 "$pkgdir/usr/bin/"
install -m755 "$srcdir/run.sh" "$pkgdir/usr/bin/karaokemugen"
install -m755 "$srcdir/install.sh" "$pkgdir/usr/bin/karaokemugen-install"
install -m755 "$srcdir/payload.sh" "$pkgdir/opt/karaokemugen/exec.sh"
# .desktop entry
install -dm755 "$pkgdir/usr/share/pixmaps/"
......
......@@ -91,21 +91,6 @@ add_user_to_group() {
fi
}
setup_pulsesocket() {
echo -e "${_BEGIN_}Creating a PulseAudio socket for sound..."
if grep -q "load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulseaudio" /etc/pulse/default.pa; then
# Already insalled
echo -e "${_COL_YELLOW_}PulseAudio socket is already exsiting. Skipping"
else
sudo tee -a /etc/pulse/default.pa > /dev/null <<EOF
# Karaoke Mugen AUR Package workaround
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulseaudio
EOF
echo -e "${_COL_GREEN_}PulseAudio socket created."
fi
}
# use colors only if we have them
if [[ $(which tput > /dev/null 2>&1 && tput -T "${TERM}" colors || echo -n '0') -ge 8 ]] ; then
_COL_YELLOW_='\e[0;33m'
......@@ -148,9 +133,5 @@ check_mugen
setup_postgres
create_system_user
add_user_to_group
sudo chown -R karaokemugen:karaokemugen /opt/karaokemugen
apply_config
echo -e "${_BEGIN_}Done! Go ahead and launch Karaoke Mugen using the desktop entry"
#!/usr/bin/env bash
# Sudo payload for Mugen
# Workaround for letting karaokemugen to access display
export XAUTHORITY="/tmp/mugenXauthority"
export HOME="/opt/karaokemugen"
touch $XAUTHORITY
xauth add $XAUTHPAYLOAD
# Workaround for letting karaokemugen to access audio
mkdir -p ~/.config/pulse/
tee ~/.config/pulse/client.conf > /dev/null <<EOT
autospawn = no
default-server = unix:/tmp/pulseaudio
EOT
electron /opt/karaokemugen/resources/app.asar "$@"
exit 0
\ No newline at end of file
......@@ -10,27 +10,7 @@
# From AUR package karaokemugen-git
launch_mugen() {
cd /opt/karaokemugen/
terms="
x-terminal-emulator
konsole
gnome-terminal
xfce4-terminal
koi8rxterm
lxterm
uxterm
xterm"
for term in $terms; do
export XAUTHPAYLOAD=$(xauth list|tail -1)
$term -e "sudo -u karaokemugen -- /opt/karaokemugen/exec.sh \"$@\""
if [ $? -eq 0 ]; then
exit 0;
fi
done
exit 1
exec electron /usr/lib/karaokemugen/app.asar
}
# use colors only if we have them
......@@ -43,17 +23,11 @@ if [[ $(which tput > /dev/null 2>&1 && tput -T "${TERM}" colors || echo -n '0')
_COL_DEFAULT_='\e[0m'
fi
# Check if the user is in the karaokemugen group
if groups | grep -q '\bkaraokemugen\b'; then
# Check if postgres is running
if lsof -Pi :5432 -sTCP:LISTEN -t >/dev/null ; then # FIXME: this command is not working as normal user
echo "Starting Karaoke Mugen..."
else
echo -e "${_COL_YELLOW_}Postgres seems down... Trying to start Karaoke Mugen anyway."
fi
# Launch Karaoke Mugen
launch_mugen
# Check if postgres is running
if lsof -Pi :5432 -sTCP:LISTEN -t >/dev/null ; then # FIXME: this command is not working as normal user
echo "Starting Karaoke Mugen..."
else
echo -e "${_COL_BRED_}->${_COL_DEFAULT_} ${_COL_YELLOW_}WARNING:${_COL_DEFAULT_} You don't have the rights to access the Karaoke Mugen app"
echo -e "${_COL_BBLUE_}You can grant yourself the access to Karaoke Mugen by executing the ${_COL_YELLOW_}\`karaokemugen-install -g\`${_COL_BBLUE_} command"
echo -e "${_COL_YELLOW_}Postgres seems down... Trying to start Karaoke Mugen anyway."
fi
# Launch Karaoke Mugen
launch_mugen
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment