summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbollo <jose.bollo@eurogiciel.fr>2013-04-17 16:35:04 +0200
committerjbollo <jose.bollo@eurogiciel.fr>2013-04-17 16:35:04 +0200
commit53d46c4012b4c7bb0f1cc91b1e006863f3d99f37 (patch)
tree26a75d2038931a63b5671214697f6869887b8052
parent6d1da8e5605aa8358cf903b3060fcd714e6c5500 (diff)
downloadwrt-widgets-53d46c4012b4c7bb0f1cc91b1e006863f3d99f37.tar.gz
wrt-widgets-53d46c4012b4c7bb0f1cc91b1e006863f3d99f37.tar.bz2
wrt-widgets-53d46c4012b4c7bb0f1cc91b1e006863f3d99f37.zip
simplification
-rwxr-xr-xinstall_desktop.sh43
-rwxr-xr-xinstall_widgets.sh52
-rw-r--r--packaging/wrt_widgets.spec13
3 files changed, 48 insertions, 60 deletions
diff --git a/install_desktop.sh b/install_desktop.sh
deleted file mode 100755
index 9693075..0000000
--- a/install_desktop.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh
-
-repo=/opt/usr/apps/
-chmod -R a+rw /opt/dbspace/
-
-dbwdgt() {
-cat << EOC
-33CFo0eFJe Annex
-yKrWwxz1KX Mancala
-ewqPdCunAO BubbleWrap
-SM31mV8fq9 Go
-EOC
-}
-
-dbwdgt |
-while read id name
-do
- bin=$(ls /opt/usr/apps/$id/bin/$id.*)
- for x in /opt/usr/apps/$id/res/wgt/*[iI][cC][oO][nN]*; do
- if [[ -f $x ]]; then
- res=$(file -b $x|cut -d , -f 2|tr -d ' '|egrep '[0-9]+x[0-9]+')
- if [[ -n "$res" ]]; then
- diric=/usr/share/icons/hicolor/$res/apps
- [[ -d $diric ]] || mkdir -p $diric
- cp $x $diric/$name.png
- fi
- fi
- done
- desk=/usr/share/applications/$name.desktop
- cat << EOC > $desk
-[Desktop Entry]
-Type=Application
-Name=$name
-Exec=$bin
-Icon=$name
-Terminal=false
-Categories=WRT;Game
-EOC
-done
-
-update-desktop-database
-xdg-icon-resource forceupdate
-
diff --git a/install_widgets.sh b/install_widgets.sh
index 24c5d29..d4147e0 100755
--- a/install_widgets.sh
+++ b/install_widgets.sh
@@ -1,17 +1,55 @@
#!/bin/sh
-PWD_I="/root/widget_demo"
+
+
echo "Widget Installation"
if [ "$(id -u)" != "0" ]; then
- echo "This script must be run as root" 1>&2
+ echo "This script must be run as root" >&2
exit 1
fi
-FILE=`ls ${PWD_I}/*.wgt`
-if [ -z "$FILE" ]; then
- echo "$PWD_I doesn't contains any widgets (.wgt)" 1>&2
+
+wgtdir=/root/widget_demo
+if [ -z "$(ls $wgtdir/*.wgt 2> /dev/null)" ]; then
+ echo "$wgtdir doesn't contains any widgets (.wgt)" 1>&2
exit 1
fi
-for i in $FILE
+
+for wgt in $wgtdir/*.wgt
do
-wrt-installer -i $i
+ echo "installing $wgt"
+ wrt-installer -i $wgt
done
+
+repo=/opt/usr/apps/
+chmod -R a+rw /opt/dbspace/
+
+wrt-launcher --list |
+awk 'NR>2{print $2, $5, $6}' |
+while read name packid appid
+do
+ bin=$repo/$packid/bin/$appid
+ for x in $repo/$packid/res/wgt/*[iI][cC][oO][nN]*; do
+ if [[ -f $x ]]; then
+ res=$(file -b $x|cut -d , -f 2|tr -d ' '|egrep '[0-9]+x[0-9]+')
+ if [[ -n "$res" ]]; then
+ diric=/usr/share/icons/hicolor/$res/apps
+ [[ -d $diric ]] || mkdir -p $diric
+ cp $x $diric/$name.png
+ fi
+ fi
+ done
+ desk=/usr/share/applications/$name.desktop
+ cat << EOC > $desk
+[Desktop Entry]
+Type=Application
+Name=$name
+Exec=$bin
+Icon=$name
+Terminal=false
+Categories=WRT;Game
+EOC
+done
+
+update-desktop-database
+xdg-icon-resource forceupdate
+
diff --git a/packaging/wrt_widgets.spec b/packaging/wrt_widgets.spec
index dbd94f8..bea137a 100644
--- a/packaging/wrt_widgets.spec
+++ b/packaging/wrt_widgets.spec
@@ -23,11 +23,8 @@ Description: Wrt_Widget DEMO
%install
-chmod a+x install_widgets.sh
-chmod a+x load_widget.sh
mkdir -p %{buildroot}/usr/bin/
cp install_widgets.sh %{buildroot}/usr/bin/
-cp load_widget.sh %{buildroot}/usr/bin/
if [ ! -d %{buildroot}/root/widget_demo ]
then
@@ -47,17 +44,13 @@ mkdir -p /usr/share/applications_tmp
mv /usr/share/applications/* /usr/share/applications_tmp/
ail_initdb
mv /usr/share/applications_tmp/* /usr/share/applications/
-for d in dbspace home usr; do find /opt/$d -exec chsmack -a _ {} \; ; done;
+for d in dbspace home usr; do find /opt/$d -exec chsmack -a '*' {} \; ; done;
find /usr/lib64/ -exec chsmack -a _ {} \;
-
-
-
-
-echo "Please Reboot and Execute the scripts install_widgets.sh & load_widget.sh in root mode "
+echo "Please Reboot and Execute the script install_widgets.sh as user root"
%files
/root/widget_demo/*.wgt
/usr/bin/install_widgets.sh
-/usr/bin/load_widget.sh
+