forked from KDE/plasma-redshift-control
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added create-plasmoid-package.sh for *.plasmoid file generation
- Loading branch information
1 parent
31174e4
commit f09ee21
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
DIR="$( dirname "${BASH_SOURCE[0]}" )" | ||
CURRDIR=$PWD | ||
cd $DIR | ||
rm -r buildWidget | ||
mkdir buildWidget | ||
|
||
#compile translations used inside the plasmoid | ||
pushd po | ||
./build.sh | ||
popd | ||
|
||
cd package | ||
|
||
|
||
VERSION=$(cat ./metadata.json | jq -r '.KPlugin.Version') | ||
# ) | ||
# | ||
# ( grep \"Version\" ./metadata.json | cut -d':' -f 2 )" | ||
echo $VERSION | ||
|
||
zip -r "../buildWidget/plasma6-redshift-control-$VERSION.plasmoid" * --exclude \.git\* --exclude *.bak | ||
|
||
rm -dr contents/locale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
# Version: 6 | ||
|
||
# This script will convert the *.po files to *.mo files, rebuilding the package/contents/locale folder. | ||
# Feature discussion: https://phabricator.kde.org/D5209 | ||
# Eg: contents/locale/fr_CA/LC_MESSAGES/plasma_applet_org.kde.plasma.eventcalendar.mo | ||
|
||
DIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd` | ||
plasmoidName=`jq -r .KPlugin.Id "$DIR/../package/metadata.json"` | ||
website=`jq -r .KPlugin.Website "$DIR/../package/metadata.json"` | ||
|
||
bugAddress="$website" | ||
packageRoot=".." # Root of translatable sources | ||
projectName="plasma_applet_${plasmoidName}" # project name | ||
|
||
#--- | ||
if [ -z "$plasmoidName" ]; then | ||
echo "[build] Error: Couldn't read plasmoidName." | ||
exit | ||
fi | ||
|
||
if [ -z "$(which msgfmt)" ]; then | ||
echo "[build] Error: msgfmt command not found. Need to install gettext" | ||
echo "[build] Running 'sudo apt install gettext'" | ||
sudo apt install gettext | ||
echo "[build] gettext installation should be finished. Going back to installing translations." | ||
fi | ||
|
||
#--- | ||
echo "[build] Compiling messages" | ||
|
||
catalogs=`find . -name '*.po' | sort` | ||
for cat in $catalogs; do | ||
echo "$cat" | ||
catLocale=`basename ${cat%.*}` | ||
msgfmt -o "${catLocale}.mo" "$cat" | ||
|
||
installPath="$DIR/../package/contents/locale/$(echo $cat | cut -d/ -f2)/LC_MESSAGES/${projectName}.mo" | ||
|
||
echo "[build] Install to ${installPath}" | ||
mkdir -p "$(dirname "$installPath")" | ||
mv "${catLocale}.mo" "${installPath}" | ||
done | ||
|
||
echo "[build] Done building messages" | ||
|
||
if [ "$1" = "--restartplasma" ]; then | ||
echo "[build] Restarting plasmashell" | ||
killall plasmashell | ||
kstart5 plasmashell | ||
echo "[build] Done restarting plasmashell" | ||
else | ||
echo "[build] (re)install the plasmoid and restart plasmashell to test." | ||
fi |