Jump to content


Photo

Check if a file exists using ppanels?


  • Please log in to reply
5 replies to this topic

#1 mrdude

  • Senior Member
  • 90 posts

0
Neutral

Posted 10 April 2009 - 22:37

Hi I have made a little bit on a ppanel so I can flash an image:

<category name="Flash Dreambox Image">
<comment name=" ***WARNING***"/>
<comment name="Make sure your image has firstly been ftp'd"/>
<comment name="to the dreambox and is stored in /tmp or the"/>
<comment name="box will be erased but not flashed and will"/>
<comment name=" ***FAIL TO REBOOT***"/>
<separator/>
<execute name=" FLASH DREAMBOX"
target="echo - flashing image please wait until box reboots;cd /tmp &amp;&amp; eraseall /dev/mtd/3 &amp;&amp; cp *.img /dev/mtd/3 &amp;&amp; reboot;***DO NOT UNPLUG***;"
helptext="Your image should be ftp'd to the /tmp directory before flashing"
confirmation="Are you sure you wish to flash the dreambox?"/>
<separator/>
<comment name=" ***WARNING***"/>
<comment name="Do NOT turn off once flashing starts - the box"/>
<comment name=" will reboot automatically"/>
</category>


I am quite rubbish at linux - is there a way I can check if the *.img file exists before flashing begins and if the file is not found in tmp the ppanel will exit with a message saying something like - image file not found cancelling flash procedure.

Cheers.

Re: Check if a file exists using ppanels? #2 hemertje

  • Forum Moderator
    PLi® Core member
  • 33,472 posts

+118
Excellent

Posted 11 April 2009 - 09:03

whatś the advantage of such a PPanel as you can flash images from the menu by hand or automaticly or even with the webinterface?

on the Glassfibre 1GB DVB-C...


Re: Check if a file exists using ppanels? #3 mrdude

  • Senior Member
  • 90 posts

0
Neutral

Posted 11 April 2009 - 19:19

Well it's all to do with learning about ppanels and linux m8, if you can't help though I'll look elsewhere as I am sure there must be a few sites where I can learn some linux scripting.

I thought I'd try here though as you guys made the ppanel system in this image and I thought this would be the best place to try and get help - but hey never mind.

Thanks though - jade 2 is a great image.

Re: Check if a file exists using ppanels? #4 nfnovice

  • Senior Member
  • 696 posts

0
Neutral

Posted 12 April 2009 - 06:19

Well it's all to do with learning about ppanels and linux m8, if you can't help though I'll look elsewhere as I am sure there must be a few sites where I can learn some linux scripting.

I thought I'd try here though as you guys made the ppanel system in this image and I thought this would be the best place to try and get help - but hey never mind.

Thanks though - jade 2 is a great image.


I agree with hermetje - you seem to be re-inventing the wheel that already exists
also as ppanel syntax is unique (peculiar) to pli image - it is not a great way to learn linux scripting

all that aside I have done previously what you asked about
this code in a ppanel will show an executable comand if the log file exists - if it does not exists it will show a comment saying it doesnt. It could easily be amended for your needs

    <execute name="Show Last Crond run Log (log exists)"
    condition="[ -f /var/tmp/oztivo_au.sh.log ]"
	   target="cat /var/tmp/oztivo_au.sh.log" helptext="Show /var/tmp/oztivo_au.sh.log"/>
    <comment name="Cron has not run Oztivo Yet (no log oztivo_au.sh.log)" condition="[ ! -f /var/tmp/oztivo_au.sh.log ]"/>


Re: Check if a file exists using ppanels? #5 mrdude

  • Senior Member
  • 90 posts

0
Neutral

Posted 12 April 2009 - 16:28

I agree with hermetje - you seem to be re-inventing the wheel that already exists
also as ppanel syntax is unique (peculiar) to pli image - it is not a great way to learn linux scripting

all that aside I have done previously what you asked about
this code in a ppanel will show an executable comand if the log file exists - if it does not exists it will show a comment saying it doesnt. It could easily be amended for your needs

    <execute name="Show Last Crond run Log (log exists)" 
    condition="[ -f /var/tmp/oztivo_au.sh.log ]" 
	   target="cat /var/tmp/oztivo_au.sh.log" helptext="Show /var/tmp/oztivo_au.sh.log"/> 
    <comment name="Cron has not run Oztivo Yet (no log oztivo_au.sh.log)" condition="[ ! -f /var/tmp/oztivo_au.sh.log ]"/> 



Thanks m8, with your help that's me sorted now and completed the ppanel to my own needs.
With the update software feature in jade2 you need to change the image name to root.cram.fs - the way I do it is that I have a few different image files and as long as the file ends in .img it can be called whatever I want without renaming. I host images on a usb stick on my router which had usb so I can choose any image I want to use as I have made a ppanel to select what image to put into tmp first - that way they don't all have the same name or need to be renamed.
Thanks very much indeed for the help.

Re: Check if a file exists using ppanels? #6 patx

  • Senior Member
  • 55 posts

0
Neutral

Posted 21 April 2009 - 05:05

ever heard of multiboot ?!? much more simple...

But as you did it for learning then good job & keep learning :) !!!!!!!!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users