simplification
authorjbollo <jose.bollo@eurogiciel.fr>
Wed, 17 Apr 2013 14:35:04 +0000 (16:35 +0200)
committerjbollo <jose.bollo@eurogiciel.fr>
Wed, 17 Apr 2013 14:35:04 +0000 (16:35 +0200)
install_desktop.sh [deleted file]
install_widgets.sh
packaging/wrt_widgets.spec

diff --git a/install_desktop.sh b/install_desktop.sh
deleted file mode 100755 (executable)
index 9693075..0000000
+++ /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
-
index 24c5d2932d3191b336493e937dccef7f470889bd..d4147e096d3973beef730889bbc21af1096e550c 100755 (executable)
@@ -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
+
index dbd94f8a71e9878327dc1315144f50557071bbb9..bea137a9ac228f01523131797ae4d66879341a36 100644 (file)
@@ -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
+