Pomoc On/Off toggle

U

Usunięty użytkownik pigers

Guest
Tworze paczke QPKG i chcialbym miec mozliwosc z poziomu GUI AppCenter ON/Off
Zgodnie z sugestia @Silas Mariusz - nie mam skryptu start / stop

No to teraz troche namieszam:
1. ostatnie linie z skryptu do starttowania appek aka autoruns
Bash:
[/share/MD0_DATA/.qpkg/selfoss] # cat ../autoruns/autoruns.sh
#!/bin/sh

# Install my icons ...
# ###########################################################################
#install_icons(){
cp -af "$PROGDIR/.qpkg_icon.gif" "/home/httpd/RSS/images/${NAME}.gif" 2>/dev/null
cp -af "$PROGDIR/.qpkg_icon_gray.gif" "/home/httpd/RSS/images/${NAME}_gray.gif" 2>/dev/null
cp -af "$PROGDIR/.qpkg_icon_80.gif" "/home/httpd/RSS/images/${NAME}_80.gif" 2>/dev/null


echo 'alias cds="cd /share/MD0_DATA/Download/rtorrent/complete/"' >> /etc/profile
## get rid of command not found ##
echo 'alias cd..="cd .."' >> /etc/profile
## a quick way to get out of current directory ##
echo 'alias ..="cd .."' >> /etc/profile
echo 'alias .3="cd ../../../"' >> /etc/profile
echo 'alias .4="cd ../../../../"' >> /etc/profile
echo 'alias .5="cd ../../../../.."' >> /etc/profile
echo 'alias MDO="cd /share/MD0_DATA"' >> /etc/profile
echo 'alias shutdown="poweroff"' >> /etc/profile
echo 'alias qpkgs="cd /share/MD0_DATA/.qpkg/"' >> /etc/profile
#wget in background with SSL
echo 'alias wgetb="wget -bqc --no-check-certificate"' >> /etc/profile
export TERMINFO='/usr/share/terminfo/'
#add MEGA install WIM to tftproot location
ln -s /share/Obrazy\ ISO/_Apps/install.wim /share/tftproot/sources/install.wim

i tak to wyglada w AppCenter, ramka czerwona,

upload_2014-12-22_22-46-44.png

teraz potrzebuje miec taki sam efekt dla paczki selfoss (zielona ramka).


Ostatnie linie z pliku selfoss.sh
Bash:
###Main
init_share_settings
assign_base   
install_icons   

_case=
echo $0 | grep -iq "start"  ; [ $? == 0 ] && _case=start
echo $0 | grep -iq "stop"  ; [ $? == 0 ] && _case=stop
[ -z "$_case" ] && _case=$1   
case "$_case" in   
  "start")   
####
  fi   
###
  fi
  ;;
  "stop")
###
  fi
  ;;
  "restart")
  ## Restart procedure
  ;;
  "install")
  ln -sf $PROGDIR/selfoss.sh /etc/init.d/selfoss.sh

  qpkgconf=/etc/config/qpkg.conf
  setcfg selfoss Name selfoss -f $qpkgconf
  setcfg selfoss Version "0.0.1" -f $qpkgconf
  setcfg selfoss Author "pigers" -f $qpkgconf
  setcfg selfoss QPKG_File "selfoss.qpkg" -f $qpkgconf
  setcfg selfoss Date "2014-11-10" -f $qpkgconf
  setcfg selfoss Shell "$qpkgdir/selfoss/selfoss.sh" -f $qpkgconf
  setcfg selfoss Install_Path "$qpkgdir/selfoss" -f $qpkgconf
  setcfg selfoss WebUI "/selfoss" -f $qpkgconf
  setcfg selfoss Enable FALSE -f $qpkgconf
  ;;
  "enable")
  /sbin/setcfg ${NAME} Enable TRUE -f /etc/config/qpkg.conf
  ;;
  "disable")
  /sbin/setcfg ${NAME} Enable FALSE -f /etc/config/qpkg.conf
  ;;
  "status")
  if [ -d $SYS_WEB_PATH/selfoss ]; then
  echo "Selfoss working."
  else
  echo "Selfoss not working."
  fi
  ;;
  *)
  help
  _exit
  ;;

  esac
# Parent process has died so we also better die.
exit 0

Grzecznie pytam, czego nie wiem, czego nie robie, ze aplikacja ktora nie ma wcale sekcji odpowiedzialnej za start/stop ma switcha, a aplikacja z takim kodem nie ma .


Przyklady byly mile widziane.
 
Bash:
	"install")
ln -sf $PROGDIR/logman.sh /etc/init.d/logman.sh
ln -sf $PROGDIR/logman.sh /etc/rcS.d/QS125logman
ln -sf $PROGDIR/logman.sh /etc/rcK.d/QK125logman

qpkgconf=/etc/config/qpkg.conf
setcfg logman Name logman -f $qpkgconf
setcfg logman Version "0.0.8b" -f $qpkgconf
setcfg logman Author "Silas Mariusz" -f $qpkgconf
setcfg logman QPKG_File "logman.qpkg" -f $qpkgconf
setcfg logman Date "2014-11-11" -f $qpkgconf
setcfg logman Shell "$PROGDIR/logman.sh" -f $qpkgconf
setcfg logman Install_Path "$PROGDIR/logman" -f $qpkgconf
setcfg logman WebUI "/" -f $qpkgconf
setcfg logman RC_Number 125 -f $qpkgconf
setcfg logman Enable FALSE -f $qpkgconf

_log installed as QPKG service
;;
 
Bash:
  "install")
  ln -sf $PROGDIR/selfoss.sh /etc/init.d/selfoss.sh
  ln -sf $PROGDIR/selfoss.sh /etc/rcS.d/QS126selfoss
  ln -sf $PROGDIR/selfoss.sh /etc/rcK.d/QS126selfoss

  qpkgconf=/etc/config/qpkg.conf
  setcfg selfoss Name selfoss -f $qpkgconf
  setcfg selfoss Version "0.0.1" -f $qpkgconf
  setcfg selfoss Author "pigers" -f $qpkgconf
  setcfg selfoss QPKG_File "selfoss.qpkg" -f $qpkgconf
  setcfg selfoss Date "2014-12-23" -f $qpkgconf
  setcfg selfoss Shell "$qpkgdir/selfoss.sh" -f $qpkgconf
  setcfg selfoss Install_Path "$qpkgdir/selfoss" -f $qpkgconf
  setcfg selfoss WebUI "/selfoss" -f $qpkgconf
  setcfg selfoss Enable FALSE -f $qpkgconf
  setcfg selfoss RC_Number 126 -f $qpkgconf

mimo dodania skryptow start/stop dalej nie ma toggle'a

PS: obrazki dla QPKG ktore nie maja swoich ikon, nie wiem czemu maja ikone selfossa a jak zagladam do pliku zrodlowego to jest OKi :/

PS2: zrobilem reboot po dopisaniu zmian