Compare commits

...

No commits in common. "main" and "karaokemugen" have entirely different histories.

9 changed files with 298 additions and 3 deletions

36
.SRCINFO Normal file
View file

@ -0,0 +1,36 @@
pkgbase = karaokemugen
pkgdesc = Karaoke playlist manager/player app used in parties or events.
pkgver = 6.1.16
pkgrel = 2
url = https://mugen.karaokes.moe/
install = karaokemugen.install
arch = x86_64
license = MIT
makedepends = git
makedepends = npm
makedepends = typescript
makedepends = yarn
makedepends = nodejs>=16
makedepends = python2
depends = mpv
depends = ffmpeg
depends = postgresql
depends = patch
depends = electron19
optdepends = sudo: for using karaokemugen-install script
source = karaokemugen::git+https://gitlab.com/karaokemugen/karaokemugen-app.git#tag=v6.1.16
source = karaokemugen-lib::git+https://gitlab.com/karaokemugen/lib.git
source = karaokemugen-avatars::git+https://gitlab.com/karaokemugen/medias/guest-avatars.git
source = install.sh
source = run.sh
source = icon256.png
source = karaokemugen.desktop
md5sums = SKIP
md5sums = SKIP
md5sums = SKIP
md5sums = 8373c231fb432d6efef66e3ecf94ff0f
md5sums = 55557823030b7824a85a55469e119cb4
md5sums = 5e9a33a42fef7572b7e0fa504c586f32
md5sums = 10561eed906a5efeed427f90501b4f49
pkgname = karaokemugen

85
PKGBUILD Normal file
View file

@ -0,0 +1,85 @@
# Maintainer: leonekmi <usingarchbtw@leonekmi.fr>
pkgname=karaokemugen
pkgver=6.1.16
pkgrel=2
pkgdesc="Karaoke playlist manager/player app used in parties or events."
arch=('x86_64')
url="https://mugen.karaokes.moe/"
license=('MIT')
groups=()
depends=('mpv' 'ffmpeg' 'postgresql' 'patch' 'electron19')
makedepends=('git' 'npm' 'typescript' 'yarn' 'nodejs>=16' 'python2')
optdepends=('sudo: for using karaokemugen-install script')
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=${pkgname}.install
source=('karaokemugen::git+https://gitlab.com/karaokemugen/karaokemugen-app.git#tag=v6.1.16'
'karaokemugen-lib::git+https://gitlab.com/karaokemugen/lib.git'
'karaokemugen-avatars::git+https://gitlab.com/karaokemugen/medias/guest-avatars.git'
'install.sh'
'run.sh'
'icon256.png'
'karaokemugen.desktop')
noextract=()
md5sums=('SKIP'
'SKIP'
'SKIP'
'8373c231fb432d6efef66e3ecf94ff0f'
'55557823030b7824a85a55469e119cb4'
'5e9a33a42fef7572b7e0fa504c586f32'
'10561eed906a5efeed427f90501b4f49')
prepare() {
cd "$srcdir/${pkgname}"
git submodule init
git config submodule.src/lib.url $srcdir/${pkgname}-lib
git config submodule.assets/guestAvatars.url $srcdir/${pkgname}-avatars
git submodule update
}
build() {
cd "$srcdir/${pkgname}"
# Prepare dependencies
export HOME="$srcdir/$pkgname-home"
export XDG_CACHE_HOME="$srcdir/$pkgname-cache"
export npm_config_devdir="$srcdir/$pkgname-npm-dev"
export npm_config_cache="$srcdir/$pkgname-npm-cache"
mkdir -p $HOME $XDG_CACHE_HOME $npm_config_devdir $npm_config_cache
yarn install --frozen-lockfile
yarn add --dev electron-builder
yarn installkmfrontend
# Build and package with electron-builder
export NODE_ENV='production'
electronVer=$(electron --version | tail -c +2)
yarn build
yarn buildkmfrontend
yarn electron-builder --linux --x64 -c.electronDist=/usr/lib/electron -c.electronVersion=$electronVer --dir
}
package() {
cd "$srcdir/${pkgname}"
# Application itself
install -dm755 "$pkgdir/usr/lib/${pkgname}"
cp -dr --no-preserve=ownership packages/linux-unpacked/resources/* "$pkgdir/usr/lib/${pkgname}/"
chmod -R 755 "$pkgdir/usr/lib/${pkgname}/"
# License
install -dm755 "$pkgdir/usr/share/licenses/${pkgname}"
install -m644 LICENSE.md "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
# 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"
# .desktop entry
install -dm755 "$pkgdir/usr/share/pixmaps/"
install -dm755 "$pkgdir/usr/share/applications/"
install -m644 "$srcdir/icon256.png" "$pkgdir/usr/share/pixmaps/${pkgname}.png"
install -m644 "$srcdir/${pkgname}.desktop" "$pkgdir/usr/share/applications/${pkgname}.desktop"
}

View file

@ -1,3 +0,0 @@
# aur.git
This is a experimental mirror of the aur.git repository backing [the AUR](https://aur.archlinux.org).

40
appPath.patch Normal file
View file

@ -0,0 +1,40 @@
Index: src/index.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/index.ts b/src/index.ts
--- a/src/index.ts (revision 34a92a6909d715ac95609eb4047e9b94a2de8152)
+++ b/src/index.ts (revision 33ae1fd1580e7ac890c400d7514953a07c3c7eca)
@@ -5,7 +5,7 @@
import {copy, mkdirpSync, remove} from 'fs-extra';
import i18n from 'i18next';
import cloneDeep from 'lodash.clonedeep';
-import {resolve} from 'path';
+import {dirname,resolve} from 'path';
import {getPortPromise} from 'portfinder';
import {createInterface} from 'readline';
@@ -85,12 +85,18 @@
: resolve(app.getAppPath(), '../../');
resourcePath = process.resourcesPath;
} else {
- // Starting Electron from source folder
- appPath = app.getAppPath();
- resourcePath = appPath;
+ if (app.getAppPath().endsWith('.asar')) {
+ // Starting Electron from an asar directly (electron /path/to/app.asar)
+ appPath = dirname(app.getAppPath());
+ resourcePath = appPath;
+ } else {
+ // Starting Electron from source folder
+ appPath = app.getAppPath();
+ resourcePath = appPath;
+ }
}
} else {
- // No Electron start, so in git mode
+ // Non-electron environments (ts-node, node)
appPath = process.cwd();
resourcePath = appPath;
}

BIN
icon256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

85
install.sh Executable file
View file

@ -0,0 +1,85 @@
#!/usr/bin/env bash
# _ __ _ __ __
# | |/ /__ _ _ _ __ _ ___| |_____ | \/ |_ _ __ _ ___ _ _
# | ' </ _` | '_/ _` / _ \ / / -_) | |\/| | || / _` / -_) ' \
# |_|\_\__,_|_| \__,_\___/_\_\___| |_| |_|\_,_\__, \___|_||_|
# |___/
# This script creates the database and do some checks to make
# Karaoke Mugen App working.
# From AUR package karaokemugen-git
check_postgres() {
sudo -u postgres -g postgres pg_ctl status -D /var/lib/postgres/data &> /dev/null
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 [ $EXIT_STATUS -eq 3 ]; then
echo -e "${_COL_YELLOW_}Postgres is not running, starting..."
sudo systemctl restart postgresql
check_postgres
else
echo -e "${_COL_GREEN_}Postgres seems OK."
fi
}
check_mugen() {
if [ -f "/usr/lib/karaokemugen/app.asar" ]; then
echo -e "${_COL_GREEN_}Karaoke Mugen is installed in /usr/lib/karaokemugen."
else
echo -e "${_COL_BRED_}Karaoke Mugen is not installed in /usr/lib/karaokemugen. Exiting."
exit 1
fi
}
setup_postgres() {
echo -e "${_BEGIN_}Creating the karaokemugen_app database..."
# Create the DB for Mugen
# Check if the DB already exists
sudo -u postgres -g postgres -H -- psql -d karaokemugen_app -c ""
if [ $? -eq 0 ]; then
echo -e "${_COL_YELLOW_}karaokemugen_app database is existing, do you want to keep its content or reset it?"
select dbch in "Keep data" "Reset database"; do
case $dbch in
"Keep data" ) echo -e "${_COL_GREEN_}karaokemugen_app database will be used." ; return 0;; # TODO : maybe do some integrity checks
"Reset database" ) sudo -u postgres -g postgres -H -- psql -c "DROP DATABASE karaokemugen_app;"; sudo -u postgres -g postgres -H -- psql -c "DROP ROLE IF EXISTS karaokemugen_app;";;
esac
done
fi
# Creating the database
sudo -u postgres -g postgres -H -- psql -c "CREATE DATABASE karaokemugen_app ENCODING 'UTF8';"
sudo -u postgres -g postgres -H -- psql -c "CREATE USER karaokemugen_app WITH ENCRYPTED PASSWORD 'musubi'; GRANT ALL PRIVILEGES ON DATABASE karaokemugen_app TO karaokemugen_app;"
sudo -u postgres -g postgres -H -- psql -d karaokemugen_app -c "CREATE EXTENSION unaccent;"
echo -e "${_COL_GREEN_}karaokemugen_app database created!"
}
# 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_GREEN_='\e[0;32m'
_COL_LIGHTGREY_='\e[0;37m'
_COL_BRED_='\e[1;31m'
_COL_BBLUE_='\e[1;34m'
_COL_BWHITE_='\e[1;37m'
_COL_DEFAULT_='\e[0m'
_BEGIN_="${_COL_BRED_}-> ${_COL_BBLUE_}"
fi
echo -e "${_BEGIN_}Welcome to the Karaoke Mugen installer!"
echo -e "${_COL_YELLOW_}⚠️ You may have to enter your sudo password a couple times during this installation."
echo -e "${_COL_YELLOW_}This script may not work if you tweaked your PostgreSQL configuration."
echo -e "${_COL_YELLOW_}If you encounter any problems during installation, contact the package maintainer."
echo -e "${_COL_YELLOW_}The installation will begin in 5 seconds."
sleep 5
echo -e "${_BEGIN_}Doing some initial checks..."
check_postgres
check_mugen
setup_postgres
echo -e "${_BEGIN_}Done! Go ahead and launch Karaoke Mugen using the desktop entry"

10
karaokemugen.desktop Normal file
View file

@ -0,0 +1,10 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Karaoke Mugen
Comment=Karaoke playlist manager/player app used in parties or events.
Exec=karaokemugen
Icon=karaokemugen
Terminal=false
Type=Application
Categories=AudioVideo;Video

14
karaokemugen.install Normal file
View file

@ -0,0 +1,14 @@
post_install() {
echo "TIP: This package ships with tools to help you with Karaoke Mugen installation"
echo "- karaokemugen-install interactively creates the initial configuration and helps you with database setup."
echo "- karaokemugen launches the app with Electron UI."
}
post_upgrade() {
echo "You may need to run karaokemugen-install again. Keep that in mind."
}
post_remove() {
echo "The media files downloaded are still in the directory you set (~/KaraokeMugen/ by default)."
echo "Delete them to free space if you want."
}

28
run.sh Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# _ __ _ __ __
# | |/ /__ _ _ _ __ _ ___| |_____ | \/ |_ _ __ _ ___ _ _
# | ' </ _` | '_/ _` / _ \ / / -_) | |\/| | || / _` / -_) ' \
# |_|\_\__,_|_| \__,_\___/_\_\___| |_| |_|\_,_\__, \___|_||_|
# |___/
# This script runs Karaoke Mugen app (with some check to avoid some disasters)
# From AUR package karaokemugen-git
# 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_BLUE_='\e[0;34m'
_COL_DEFAULT_='\e[0m'
fi
# Check if postgres is running
if systemctl is-active postgresql -q ; then
echo "Starting Karaoke Mugen..."
else
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/app.asar "$@"