summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon2020-05-25 21:11:55 +0200
committerLeon2020-05-25 21:11:55 +0200
commitb8aa85401c17593d12ee55080873674a7eec018a (patch)
tree81226b306a00027fa939ed598b32ff649280c521
parent5ef68881c22660dea1bd1f35c82eaf1a0a287c8b (diff)
downloadaur-b8aa85401c17593d12ee55080873674a7eec018a.tar.gz
Cleanup; installing with multi-user mode in mind
-rw-r--r--.SRCINFO15
-rw-r--r--10-mugensudo3
-rw-r--r--PKGBUILD46
-rw-r--r--database-tweak.diff13
-rw-r--r--database.json16
-rwxr-xr-xinstall.sh62
-rw-r--r--karaokemugen.install2
-rw-r--r--payload.sh17
-rwxr-xr-xrun.sh49
9 files changed, 31 insertions, 192 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8fd9bbeeec35..5be7b7ea0afa 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = karaokemugen-git
pkgdesc = Karaoke playlist manager/player app used in parties or events.
- pkgver = 3.2.0.r0.g9ecde13e
+ pkgver = 3.2.2.r1.g029d4a0f
pkgrel = 1
url = https://mugen.karaokes.moe/
install = karaokemugen.install
@@ -11,6 +11,7 @@ pkgbase = karaokemugen-git
makedepends = typescript
makedepends = yarn
makedepends = nodejs>=12
+ makedepends = python2
depends = mpv
depends = ffmpeg
depends = postgresql
@@ -22,22 +23,14 @@ pkgbase = karaokemugen-git
source = karaokemugen-lib::git+https://lab.shelter.moe/karaokemugen/lib.git
source = install.sh
source = run.sh
- source = database-tweak.diff
- source = database.json
source = icon256.png
source = karaokemugen.desktop
- source = 10-mugensudo
- source = payload.sh
md5sums = SKIP
md5sums = SKIP
- md5sums = 7640e20425422b5cd146acbb51110ea6
- md5sums = 7f27a04c232e38ad6e070e742b0a2dda
- md5sums = c1807f76ea2d800999910fe66e56fe73
- md5sums = 0f887855e641ec949ce7c6b69d79ad1e
+ md5sums = 4ad5390b139dc5b5e78e6eef8411e90b
+ md5sums = 0d0d432f35c56a962f9d386f391c6036
md5sums = 5e9a33a42fef7572b7e0fa504c586f32
md5sums = 10561eed906a5efeed427f90501b4f49
- md5sums = 7304bcf403613a276dba896ba2d2a918
- md5sums = 6a0c5042def68d0eaffc2cc87cd11462
pkgname = karaokemugen-git
diff --git a/10-mugensudo b/10-mugensudo
deleted file mode 100644
index e2f06c2e1cb2..000000000000
--- a/10-mugensudo
+++ /dev/null
@@ -1,3 +0,0 @@
-# The users added to the karaokemugen group can launch karaokemugen using electron runtime in system
-Defaults!/usr/bin/electron,/opt/karaokemugen/exec.sh env_keep+="XAUTHORIZATION XAUTHORITY XAUTHPAYLOAD TZ PS2 PS1 PATH LS_COLORS KRB5CCNAME HOSTNAME DISPLAY COLORS"
-%karaokemugen ALL=(karaokemugen) NOPASSWD: /usr/bin/electron,/opt/karaokemugen/exec.sh
diff --git a/PKGBUILD b/PKGBUILD
index d84d3d73e159..87ea70dcc548 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,14 +1,14 @@
# 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')
-makedepends=('git' 'npm' 'typescript' 'yarn' 'nodejs>=12')
+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' 'python2')
optdepends=('sudo: for using karaokemugen-install script')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
@@ -20,23 +20,15 @@ source=('karaokemugen::git+https://lab.shelter.moe/karaokemugen/karaokemugen-app
'karaokemugen-lib::git+https://lab.shelter.moe/karaokemugen/lib.git'
'install.sh'
'run.sh'
- 'database-tweak.diff'
- 'database.json'
'icon256.png'
- 'karaokemugen.desktop'
- '10-mugensudo'
- 'payload.sh')
+ 'karaokemugen.desktop')
noextract=()
md5sums=('SKIP'
'SKIP'
- '7640e20425422b5cd146acbb51110ea6'
- '7f27a04c232e38ad6e070e742b0a2dda'
- 'c1807f76ea2d800999910fe66e56fe73'
- '0f887855e641ec949ce7c6b69d79ad1e'
+ '4ad5390b139dc5b5e78e6eef8411e90b'
+ '0d0d432f35c56a962f9d386f391c6036'
'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,36 +73,24 @@ 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}/"
-
- # 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 -dm755 "$pkgdir/usr/lib/${pkgname%-git}"
+ cp -dr --no-preserve=ownership packages/linux-unpacked/resources/* "$pkgdir/usr/lib/${pkgname%-git}/"
+ install -dm 755 "$pkgdir/usr/lib/${pkgname%-git}/asar"
+ mv "$pkgdir/usr/lib/${pkgname%-git}/app.asar" "$pkgdir/usr/lib/${pkgname%-git}/asar"
+ chmod -R 755 "$pkgdir/usr/lib/${pkgname%-git}/"
# 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/"
install -dm755 "$pkgdir/usr/share/applications/"
install -m644 "$srcdir/icon256.png" "$pkgdir/usr/share/pixmaps/${pkgname%-git}.png"
install -m644 "$srcdir/${pkgname%-git}.desktop" "$pkgdir/usr/share/applications/${pkgname%-git}.desktop"
-} \ No newline at end of file
+}
diff --git a/database-tweak.diff b/database-tweak.diff
deleted file mode 100644
index a2f45ce46b08..000000000000
--- a/database-tweak.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/config.sample.yml b/config.sample.yml
-index 4dcd6cef..570333a1 100644
---- a/config.sample.yml
-+++ b/config.sample.yml
-@@ -214,7 +214,7 @@ System:
- Postgres:
- Windows: app/bin/postgres/bin/
- OSX: app/bin/postgres/bin/
-- Linux: app/bin/postgres/bin/
-+ Linux: /usr/bin/
- Repositories:
- - Name: kara.moe
- Online: true
diff --git a/database.json b/database.json
deleted file mode 100644
index a77d8602b152..000000000000
--- a/database.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "sql-file": true,
- "defaultEnv": "prod",
- "prod": {
- "driver": "pg",
- "user": "karaokemugen_app",
- "password": "musubi",
- "host": "localhost",
- "database": "karaokemugen_app",
- "port": 5432,
- "schema": "public",
- "superuser": "postgres",
- "superuserPassword": null,
- "bundledPostgresBinary": false
- }
-} \ No newline at end of file
diff --git a/install.sh b/install.sh
index 852d2d28fd0d..03dd52470cd1 100755
--- a/install.sh
+++ b/install.sh
@@ -12,11 +12,12 @@
check_postgres() {
sudo -u postgres -g postgres pg_ctl status -D /var/lib/postgres/data &> /dev/null
- if [ $? -eq 4 ]; then
+ EXIT_STATUS=$?
+ if [ $EXIT_STATUS -eq 4 ]; then
echo -e "${_COL_YELLOW_}Postgres is not initialized, initializing..."
sudo -H -u postgres -g postgres initdb -D /var/lib/postgres/data
check_postgres
- elif [ $? -eq 3 ]; then
+ elif [ $EXIT_STATUS -eq 3 ]; then
echo -e "${_COL_YELLOW_}Postgres is not running, starting..."
sudo systemctl restart postgresql
check_postgres
@@ -55,57 +56,6 @@ setup_postgres() {
echo -e "${_COL_GREEN_}karaokemugen_app database created!"
}
-apply_config() {
- # TODO : interactively ask for some options (location of medias, etc...)
- sudo tee /opt/karaokemugen/config.yml > /dev/null <<EOT
-App:
- JwtSecret: $(uuid)
-System:
- Binaries:
- Postgres:
- Linux: /usr/bin/
-EOT
-}
-
-create_system_user() {
- if grep -q "^karaokemugen:" /etc/passwd; then
- echo -e "${_BEGIN_}Using the existing ${_COL_YELLOW_}karaokemugen${_COL_BBLUE_} system user..."
- else
- echo -e "${_BEGIN_}Creating ${_COL_YELLOW_}karaokemugen${_COL_BBLUE_} system user..."
- if grep -q "^karaokemugen:" /etc/groups; then
- sudo useradd -g karaokemugen -M -d /opt/karaokemugen karaokemugen
- else
- sudo useradd -G audio -U -M -d /opt/karaokemugen karaokemugen
- fi
- fi
-}
-
-add_user_to_group() {
- echo -e "${_BEGIN_}Adding you (${_COL_YELLOW_}$USER${_COL_BBLUE_}) to ${_COL_YELLOW_}karaokemugen${_COL_BBLUE_} group..."
- if grep -q "^karaokemugen:" /etc/group; then
- sudo usermod -a -G karaokemugen $USER
- echo -e "${_COL_GREEN_}Successfully added ${_COL_YELLOW_}$USER${_COL_GREEN_} to ${_COL_YELLOW_}karaokemugen${_COL_GREEN_} group"
- else
- echo -e "${_BEGIN_}You need first to install Karaoke Mugen by executing ${_COL_YELLOW_}\`karaokemugen-install\`${_COL_BBLUE_}."
- exit 1
- 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 +98,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"
diff --git a/karaokemugen.install b/karaokemugen.install
index 31cc4dd65d97..76aeede9d7cd 100644
--- a/karaokemugen.install
+++ b/karaokemugen.install
@@ -9,6 +9,6 @@ post_upgrade() {
}
post_remove() {
- echo "The media files downloaded are still in the directory you set (/opt/karaokemugen/app by default)."
+ echo "The media files downloaded are still in the directory you set (~/KaraokeMugen/ by default)."
echo "Delete them to free space if you want."
} \ No newline at end of file
diff --git a/payload.sh b/payload.sh
deleted file mode 100644
index f2211160e086..000000000000
--- a/payload.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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
diff --git a/run.sh b/run.sh
index db5ce0dc076e..07de3a7a7d7f 100755
--- a/run.sh
+++ b/run.sh
@@ -9,51 +9,20 @@
# This script runs Karaoke Mugen app (with some check to avoid some disasters)
# 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
-}
-
# 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'
- _COL_LIGHTGREY_='\e[0;37m'
- _COL_BRED_='\e[1;31m'
- _COL_BBLUE_='\e[1;34m'
- _COL_BWHITE_='\e[1;37m'
+ _COL_BLUE_='\e[0;34m'
_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 systemctl is-active postgresql -q ; then
+ 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 PostgreSQL before Karaoke Mugen.${_COL_DEFAULT_}"
+ echo -e "${_COL_BLUE_}You may want to start PostgreSQL at boot with `systemctl enable postgresql`.${_COL_DEFAULT_}"
+ systemctl start postgresql
fi
+# Launch Karaoke Mugen
+exec electron /usr/lib/karaokemugen/asar/app.asar "$@"