New Application: S. N. A. P.


Recommended Posts

  • Replies 566
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I guess you did not see my earlier post http://lime-technology.com/forum/index.php?topic=5904.msg99005#msg99005

 

Joe L.

 

Ok Joe, I looked again.  Please look at the attached script.  To me it looks like it follows your example but when I run it the code in the f=() is displayed at the bottom of the page.  I really don't get why that is happening.

551-unmenu_user_script_SNAP_update_check.txt

Link to comment

I guess you did not see my earlier post http://lime-technology.com/forum/index.php?topic=5904.msg99005#msg99005

 

Joe L.

 

Ok Joe, I looked again.  Please look at the attached script.  To me it looks like it follows your example but when I run it the code in the f=() is displayed at the bottom of the page.  I really don't get why that is happening.

You have

f='( stuff )'

You need

f=`( stuff )`

 

The correct character for "command substitution" is the back-quote, not the single-quote

 

Joe L.

Link to comment

I guess you did not see my earlier post http://lime-technology.com/forum/index.php?topic=5904.msg99005#msg99005

 

Joe L.

 

Ok Joe, I looked again.  Please look at the attached script.  To me it looks like it follows your example but when I run it the code in the f=() is displayed at the bottom of the page.  I really don't get why that is happening.

You have

f='( stuff )'

You need

f=`( stuff )`

 

The correct character for "command substitution" is the back-quote, not the single-quote

 

Joe L.

 

Doh!  Now I get it.  Hopefully these script files will be ready for primetime.  

 

EDIT:  Joe L., Can you check these out and see if they are ready to be added to your downloads?

snap_user_script_buttons.zip

Link to comment

EDIT:  Joe L., Can you check these out and see if they are ready to be added to your downloads?

I don't think so... not yet.  I see this when I visit the User-Scripts screen after putting the two files in the unmenu directory.  You probably have not tried them with a "clean" install, where you do not have the files already in place.

 

Joe L.

SNAP-Buttons.JPG.1666a0a54a285b11ee5c699cb8287d38.JPG

Link to comment

EDIT:  Joe L., Can you check these out and see if they are ready to be added to your downloads?

I don't think so... not yet.  But you are close...  I see this when I visit the User-Scripts screen after putting the two files in the unmenu directory.  You probably have not tried them with a "clean" install, where you do not have the files already in place.

 

Joe L.

Link to comment

Hey Joe, I'm pretty sure these buttons are ready.  I've tested the install with fresh install, update and reinstall.  If any issues arise now they would be in the install script that is downloaded with the new files each time.

I'm sorry to say, I still get the exact same error.  A diff of the new and older versions of your buttons does not show any logic changes, just a wording change and a few unused lines removed.  The install button does not work.

 

Running the USER_SCRIPT_TEST line on the Linux command line shows this, all apparently destined for the "button" label.  Obviously, it does not fit.  In fact, it apparently installed the SNAP package, before I pressed anything.

 

test -s /tmp/snap.newfiles &&  echo "`/tmp/snap/snap-install.sh -t | tr '[:lower:]' '[:upper:]'` SNAP Updates"

/tmp/snap/snap.sh: line 79: /boot/config/snap/snapCommon.sh: No such file or directory

/TMP/SNAP

----------

----------

INSTALLING SNAP...

----------

NOTE:  SNAP.SH WILL OVERWRITE /BOOT/CONFIG/SMB-EXTRA.CONF AT BOOT TIME.

IF YOU HAVE CUSTOM SAMBA SETTINGS IN THAT FILE THAT YOU DON'T

WANT OVERWRITTEN THEN YOU SHOULD COPY THAT INFORMATION

INTO /BOOT/CONFIG/SNAP/SNAP-GLOBAL-TEMPLATE BEFORE BOOTING WITH SNAP.

----------

COPYING /BOOT/CONFIG/SNAP/INOTIFY-TOOLS*.TGZ TO THE /BOOT/PACKAGES/ DIRECTORY...

----------

'ADDING /BOOT/CONFIG/SNAP/SNAP.SH -B' TO /BOOT/CONFIG/GO FILE...

SUCCESSFUL INSTALL!

SNAP IS INSTALLED AND WILL RUN AUTOMATICALLY WHEN YOU BOOT THIS COMPUTER.

TO START SNAP YOU CAN REBOOT OR YOU CAN START SNAP MANUALLY BY

TYPING THIS COMMAND '/BOOT/CONFIG/SNAP/SNAP.SH -B' NOW. SNAP Updates

 

The commands it printed are all in upper case, which will only confuse users not familiar with linux and its need for case sensitive commands.

 

My system does have an existing /tmp/snap.newfiles file from a prior failed install.  You need to be able to deal with that, and of course, not install ANYTHING until the button is pressed.

The USER_SCRIPT_TEST  should not install anything.  It should just emit the label text if the button should be shown to a user, and no text if it should be hidden at that time.

 

I did not press anything, yet the package installed itself.  That is not correct behavior. 

 

Next, you are installing a .tgz package in /boot/config/snap.  That is not in accordance with all the other packages installed in /boot/packages.  It really should go there (in /boot/packages).  Also, it is an older version than the one being distributed in unmenu's package manager.  You are distributing inotify-tools-3.8-i486-1.tgz, yet the one in the unMENU's package manager is /boot/packages/inotify-tools-3.13-i486-1.tgz.  (5 versions newer)  Why include inotify-tools at all.  Why not just emit a message stating its installation is required and let the package manager do its job.  That would be the correct way to handle that, and then the .tgz would be with all the other packages.

 

Apparently you replace the config/smb-extra.conf file with your own. 

Expect that to cause MAJOR problems with many users.  Myself included.  That is simply not appropriate behavior.  You don't seem to even make a backup copy, you just blank it out.  Un-acceptable. 

 

If I had rebooted and SNAP started itself it would have wiped out my custom settings.  Not nice.  (And remember,  I had not installed anything, I just displayed the User-Scripts page.  It modified my "go" script without me pressing any "Install" button.)  Sorry but I do not feel the snap buttons are ready for inclusion in the official unRAID distribution.

 

I think for now I'll let your SNAP users test this for you and give you more feedback.  It is just not working as you intend.   

 

When the dust settles, I'll re-visit the inclusion of the buttons in the unMENU release_list.

 

Joe L.

Link to comment

I know you are trying to create buttons to do your own update and install check, and that is fine... but you should probably be creating a .conf file so that unMenu's package manager can handle everything you are trying to do, along with the initial installation.

 

I think you are worried about not getting an update to SNAP out quick enough.  The cool thing about that is that your users can just replace the .conf file when you create a new one, disable the auto install and install the new version.

 

Take a look at all the .conf files currently available and start there.  The Airvideo and Transmission packages are fairly beefy and should give you a good place to start.  The GCC package is also a good one to use.  You can point to the files you need in your google code repo and go from there.

Link to comment

I know you are trying to create buttons to do your own update and install check, and that is fine... but you should probably be creating a .conf file so that unMenu's package manager can handle everything you are trying to do, along with the initial installation.

 

I think you are worried about not getting an update to SNAP out quick enough.  The cool thing about that is that your users can just replace the .conf file when you create a new one, disable the auto install and install the new version.

 

Take a look at all the .conf files currently available and start there.  The Airvideo and Transmission packages are fairly beefy and should give you a good place to start.  The GCC package is also a good one to use.  You can point to the files you need in your google code repo and go from there.

 

I did try to go that route but the .conf mechanism is simply not capable of handling the situation. 

Link to comment

I know you are trying to create buttons to do your own update and install check, and that is fine... but you should probably be creating a .conf file so that unMenu's package manager can handle everything you are trying to do, along with the initial installation.

 

I think you are worried about not getting an update to SNAP out quick enough.  The cool thing about that is that your users can just replace the .conf file when you create a new one, disable the auto install and install the new version.

 

Take a look at all the .conf files currently available and start there.  The Airvideo and Transmission packages are fairly beefy and should give you a good place to start.  The GCC package is also a good one to use.  You can point to the files you need in your google code repo and go from there.

 

I did try to go that route but the .conf mechanism is simply not capable of handling the situation. 

What is missing that it might need?

 

Joe L.

Link to comment

Joe, I've included the update button code here.  This button is only capable of downloading a tarball and then presenting a form which a user must click on.

Where is this uppper case code text you are referring to??  The buttons clearly follow your example.  They are quite simple.  I can't see how this test could install anything without a user clicking the install button.  /tmp/snap/snap-install.sh -t  returns text, it doesn't install anything. 

 

 

test -s /tmp/snap.newfiles &&  echo "`/tmp/snap/snap-install.sh -t | tr '[:lower:]' '[:upper:]'` SNAP Updates"

 

#define USER_SCRIPT_LABEL Check for SNAP updates
#define USER_SCRIPT_DESCR Check for updates, if any then copy the .conf file to packages folder
#UNMENU_RELEASE $Revision: 7 $ $Date: 2011-01-16 23:12:23 -0400 (Sun, 16 Jan 2011) $
#echo http://unraid-snap.googlecode.com/files/snap-package.tgz

#define USER_SCRIPT_LABEL Check for SNAP Updates
#define USER_SCRIPT_DESCR Check the google.code Subversion archive for SNAP Updates
#define USER_SCRIPT_TEST echo "Check for SNAP Updates"
#UNMENU_RELEASE $Revision: 193 $ $Date: 2010-12-15 09:59:01 -0500 (Wed, 15 Dec 2010) $
PATH=$PATH:.
cwd=`pwd`

NewFilesExist=0;
SNAPrepository=/tmp/snap
SNAPhtml=/tmp/snap.html
SNAPdownloadlist=/tmp/snap.downloadlist
UNMENUfolder=/boot/unmenu
UNMENUpackagesfolder=/boot/packages

f=`(


wget -q -O $SNAPhtml http://code.google.com/p/unraid-snap/downloads/list 2>&1
cat $SNAPhtml |grep "http://unraid-snap.googlecode.com/files/snap-.*.tgz"|grep "snap-current-release"|grep -o '"http://unraid-snap.googlecode.com/files/snap-.*.tgz"' | sed s/\"//g | uniq>/tmp/snap.downloadlist

#  If there are new files, then untar them.
if [ -s $SNAPdownloadlist ] 
then
rm -r /tmp/snap >/dev/null 2>&1
rm /tmp/snap.newfiles > /dev/null 2>&1

# check if any of the files have not been downloaded before.
while read line
do
	if [ -z "$line" ];then
		break;
	fi
	filename=$(basename $line)
	if [ ! -d $SNAPrepository ]
	then
		mkdir $SNAPrepository
	fi
	wget -O ${SNAPrepository}/${filename} $line 2>&1
	if [ -f ${SNAPrepository}/${filename} ]
	then
		echo -e "\nThis file was downloaded: $filename"
		echo -e "The contents extracted to /tmp/snap\n"
		echo $(date) >/tmp/snap.newfiles


		cd $SNAPrepository; tar -xf $filename

		find $SNAPrepository/*|while read line2
		do
			fname=$(basename $line2)
			echo "     $fname"
		done 
	fi
done < $SNAPdownloadlist	

fi

)`


if [ -s /tmp/snap.newfiles ]
then
PossibleAction=`/tmp/snap/snap-install.sh -t`

NewVersion=`$SNAPrepository/snap.sh -v`

case $PossibleAction in
'install'|'update')
	cat <<EOF
	<form target="user_scripts">
	<input type=submit name="command" value="INSTALL SNAP Updates"> Install SNAP version $NewVersion Updates.<br>
	</form>
EOF
;;
'reinstall')
	cat <<EOF
	<form target="user_scripts">
	<input type=submit name="command" value="REINSTALL SNAP Updates"> Reinstall SNAP version $NewVersion<br>
	</form>
EOF

;;
esac
fi
echo "<pre>"
echo "$f"

 

 

#define USER_SCRIPT_LABEL Install SNAP updates
#define USER_SCRIPT_DESCR Install updates
#UNMENU_RELEASE $Revision: 7 $ $Date: 2011-01-16 23:12:23 -0400 (Sun, 16 Jan 2011) $
#echo http://unraid-snap.googlecode.com/files/snap-package.tgz

#define USER_SCRIPT_LABEL Install SNAP Updates
#define USER_SCRIPT_DESCR Check the google.code Subversion archive for SNAP Updates
#define USER_SCRIPT_TEST test -s /tmp/snap.newfiles &&  echo "`/tmp/snap/snap-install.sh -t | tr '[:lower:]' '[:upper:]'` SNAP Updates"
#UNMENU_RELEASE $Revision: 193 $ $Date: 2010-12-15 09:59:01 -0500 (Wed, 15 Dec 2010) $
PATH=$PATH:.
cwd=`pwd`
echo "<pre>"
if [ -s /tmp/snap.newfiles ]
then
# There must be some new files to install. 
if [ -d /tmp/snap ]
then
	if [ -f /tmp/snap/snap-install.sh ]
	then
		PossibleAction=`/tmp/snap/snap-install.sh -t`

		case $PossibleAction in
			'reinstall')
				echo "Running /tmp/snap/snap-install.sh -r"
				/tmp/snap/snap-install.sh -r #2>&1 >/tmp/snap-install.log
			;;
			'install'|'update')
				echo "Running /tmp/snap/snap-install.sh -i"

				/tmp/snap/snap-install.sh -i #2>&1 >/tmp/snap-install.log
			;;
		esac
		case $? in
		0)
			rm /tmp/snap.newfiles
			echo "Installation successful: `date`" >>/tmp/snap-install.log
			echo -e "\n\nInstallation successful"
			cat /tmp/snap-install.log
		;;
		2)
			echo "Installation was not run, all files are current.: `date`" >>/tmp/snap-install.log
			cat /tmp/snap-install.log
		;;
		*)
			echo "Installation failed, reason not specified: `date`" >>/tmp/snap-install.log
			cat /tmp/snap-install.log
		;;
		esac


	fi
else
	echo "No files were found.  No /tmp/snap folder found."

fi
fi

Link to comment

What is missing that it might need?

 

Joe L.

 

Ditto, feel free to PM me if you like.  I have written a few of the .conf files (Airvideo and Transmission to name a few, both with tweaks from JoeL) and have only run into a couple of situations were something I would like to add did not exist, and in those situations JoeL was able to add it.

Link to comment

And Joe, you can't be expecting to run the Install button BEFORE you run the download updates button can you?  You shouldn't try to run bits of code out of sequence.

 

Then the Install button should be hidden until the Update button is pressed.  The Start and Stop Crashplan buttons do not show on the page unless Crashplan is actually installed.

 

I have not had a chance to mess with any of the buttons you have put up but if I get a chance I will put it on my test server sometime this weekend.

Link to comment

And Joe, you can't be expecting to run the Install button BEFORE you run the download updates button can you?  You shouldn't try to run bits of code out of sequence.

 

Then the Install button should be hidden until the Update button is pressed.  The Start and Stop Crashplan buttons do not show on the page unless Crashplan is actually installed.

 

I have not had a chance to mess with any of the buttons you have put up but if I get a chance I will put it on my test server sometime this weekend.

 

It is hidden.  The file /tmp/snap.newfiles can't exist without performing the download button.  Come on people.  Joe, delete that file like it would be and try the buttons as they can be run from the page.  In fact, delete the /tmp/snap folder that is hanging around from an earlier test of the button before it was working.

Link to comment

And Joe, you can't be expecting to run the Install button BEFORE you run the download updates button can you?  You shouldn't try to run bits of code out of sequence.

You have to anticipate anything.  I've run your commands here as you've posted them for me to try.

Yes I do have a /tmp/snap.newfiles that exists from a prior attempt at installation back on the 22nd.  Other will too.

 

root@Tower:/boot/unmenu# ls -l /tmp/snap*

total 124

drwxr-xr-x 2 root root    0 Jan 22 08:51 snap/

-rw-r--r-- 1 root root    55 Jan 27 08:30 snap-install.log

-rw-r--r-- 1 root root    60 Jan 22 08:51 snap.downloadlist

-rw-r--r-- 1 root root 26249 Jan 22 08:51 snap.html

-rw-r--r-- 1 root root    29 Jan 22 08:51 snap.newfiles

-rw-r--r-- 1 root root  197 Jan 22 12:13 snap_example.sh

 

I just deleted /boot/config/snap and everything in it.

root@Tower:/boot/unmenu# rm -rf /boot/config/snap

root@Tower:/boot/unmenu# ls -l /boot/config/snap

/bin/ls: cannot access /boot/config/snap: No such file or directory

 

I then run your "Label" command

/tmp/snap/snap-install.sh -t

/tmp/snap

/tmp/snap/snap.sh: line 79: /boot/config/snap/snapCommon.sh: No such file or directory

----------

----------

Installing Snap...

----------

Note:  Snap.sh will overwrite /boot/config/smb-extra.conf at boot time.

If you have custom samba settings in that file that you don't

want overwritten then you should copy that information

into /boot/config/snap/snap-global-template before booting with Snap.

----------

Copying /boot/config/snap/inotify-tools*.tgz to the /boot/packages/ directory...

----------

'Adding /boot/config/snap/snap.sh -b' to /boot/config/go file...

Successful install!

Snap is installed and will run automatically when you boot this computer.

To start Snap you can reboot or you can start Snap manually by

typing this command '/boot/config/snap/snap.sh -b' now.

 

You say the -t option does not install anything... Wrong...

ls -l /boot/config/snap

root@Tower:/boot/unmenu# ls -l /boot/config/snap

total 368

-rwxrwxrwx 1 root root  1388 Jan 22 01:58 hotPlugAfterShareEvent.sh*

-rwxrwxrwx 1 root root  86833 Jan 22 02:01 inotify-tools-3.8-i486-1.tgz*

-rwxrwxrwx 1 root root 100403 Jan 22 05:41 snap-0.47-beta2.tgz*

-rwxrwxrwx 1 root root    116 Jan 22 01:58 snap-global-template*

-rwxrwxrwx 1 root root  2922 Jan 22 05:23 snap-install.sh*

-rwxrwxrwx 1 root root    53 Jan 22 01:58 snap-xdrive-template*

-rwxrwxrwx 1 root root  31775 Jan 22 01:58 snap.sh*

-rwxrwxrwx 1 root root    219 Jan 22 01:58 snapCommon.sh*

-rwxrwxrwx 1 root root  1634 Jan 22 01:58 snapEvents.sh*

-rwxrwxrwx 1 root root  1973 Jan 22 01:58 snapNotify.sh*

-rwxrwxrwx 1 root root  1535 Jan 22 02:06 snapSambaNotify.sh*

 

In addition it appended a line to my "go" script.

 

Running with the -xv options I see the install

root@Tower:/boot/unmenu# sh -xv /tmp/snap/snap-install.sh -t

### snap-install.sh

### Dave Lewis

### Jan 21, 2010

 

whereThisScriptIs="`echo $(dirname $(readlink -f $0))`"

echo $(dirname $(readlink -f $0))

dirname $(readlink -f $0)

readlink -f $0

++++ readlink -f /tmp/snap/snap-install.sh

+++ dirname /tmp/snap/snap-install.sh

++ echo /tmp/snap

+ whereThisScriptIs=/tmp/snap

REINSTALL="no"

+ REINSTALL=no

echo $whereThisScriptIs

+ echo /tmp/snap

/tmp/snap

if [ "$1" == "reinstall" ]

then

        REINSTALL="yes"

fi

+ '[' -t == reinstall ']'

BOOTCONFIG=/boot/config

+ BOOTCONFIG=/boot/config

SNAPHOME=/boot/config/snap

+ SNAPHOME=/boot/config/snap

INSTALLTYPE='full' # full or update

+ INSTALLTYPE=full

INSTALLDIRECTORY=/tmp/snap

+ INSTALLDIRECTORY=/tmp/snap

 

if [ -f $whereThisScriptIs/snap.sh ] && [ "$whereThisScriptIs" != "$SNAPHOME" ]

then

        INSTALLDIRECTORY=$whereThisScriptIs

fi

+ '[' -f /tmp/snap/snap.sh ']'

+ '[' /tmp/snap '!= /boot/config/snap ]'

+ INSTALLDIRECTORY=/tmp/snap

PriorVersion=""

+ PriorVersion=

NewVersion=`$INSTALLDIRECTORY/snap.sh -v`

$INSTALLDIRECTORY/snap.sh -v

++ /tmp/snap/snap.sh -v

/tmp/snap/snap.sh: line 79: /boot/config/snap/snapCommon.sh: No such file or directory

+ NewVersion=

 

If I look again at /boot/config/snap it has a new set of files.

 

Sorry... but that is not a "test" only option.

 

Joe L.

 

 

 

 

Link to comment

And Joe, you can't be expecting to run the Install button BEFORE you run the download updates button can you?  You shouldn't try to run bits of code out of sequence.

You have to anticipate anything.  I've run your commands here as you've posted them for me to try.

Yes I do have a /tmp/snap.newfiles that exists from a prior attempt at installation back on the 22nd.  Others will too.

 

root@Tower:/boot/unmenu# ls -l /tmp/snap*

total 124

drwxr-xr-x 2 root root     0 Jan 22 08:51 snap/

-rw-r--r-- 1 root root    55 Jan 27 08:30 snap-install.log

-rw-r--r-- 1 root root    60 Jan 22 08:51 snap.downloadlist

-rw-r--r-- 1 root root 26249 Jan 22 08:51 snap.html

-rw-r--r-- 1 root root    29 Jan 22 08:51 snap.newfiles

-rw-r--r-- 1 root root   197 Jan 22 12:13 snap_example.sh

 

I just deleted /boot/config/snap and everything in it.

root@Tower:/boot/unmenu# rm -rf /boot/config/snap

root@Tower:/boot/unmenu# ls -l /boot/config/snap

/bin/ls: cannot access /boot/config/snap: No such file or directory

 

I then run your "Label" command

/tmp/snap/snap-install.sh -t

/tmp/snap

/tmp/snap/snap.sh: line 79: /boot/config/snap/snapCommon.sh: No such file or directory

----------

----------

Installing Snap...

----------

Note:  Snap.sh will overwrite /boot/config/smb-extra.conf at boot time.

If you have custom samba settings in that file that you don't

want overwritten then you should copy that information

into /boot/config/snap/snap-global-template before booting with Snap.

----------

Copying /boot/config/snap/inotify-tools*.tgz to the /boot/packages/ directory...

----------

'Adding /boot/config/snap/snap.sh -b' to /boot/config/go file...

Successful install!

Snap is installed and will run automatically when you boot this computer.

To start Snap you can reboot or you can start Snap manually by

typing this command '/boot/config/snap/snap.sh -b' now.

 

You say the -t option does not install anything... Wrong...

ls -l /boot/config/snap

root@Tower:/boot/unmenu# ls -l /boot/config/snap

total 368

-rwxrwxrwx 1 root root   1388 Jan 22 01:58 hotPlugAfterShareEvent.sh*

-rwxrwxrwx 1 root root  86833 Jan 22 02:01 inotify-tools-3.8-i486-1.tgz*

-rwxrwxrwx 1 root root 100403 Jan 22 05:41 snap-0.47-beta2.tgz*

-rwxrwxrwx 1 root root    116 Jan 22 01:58 snap-global-template*

-rwxrwxrwx 1 root root   2922 Jan 22 05:23 snap-install.sh*

-rwxrwxrwx 1 root root     53 Jan 22 01:58 snap-xdrive-template*

-rwxrwxrwx 1 root root  31775 Jan 22 01:58 snap.sh*

-rwxrwxrwx 1 root root    219 Jan 22 01:58 snapCommon.sh*

-rwxrwxrwx 1 root root   1634 Jan 22 01:58 snapEvents.sh*

-rwxrwxrwx 1 root root   1973 Jan 22 01:58 snapNotify.sh*

-rwxrwxrwx 1 root root   1535 Jan 22 02:06 snapSambaNotify.sh*

 

In addition it appended a line to my "go" script.

 

Running with the -xv options I see the install

root@Tower:/boot/unmenu# sh -xv /tmp/snap/snap-install.sh -t

### snap-install.sh

### Dave Lewis

### Jan 21, 2010

 

whereThisScriptIs="`echo $(dirname $(readlink -f $0))`"

echo $(dirname $(readlink -f $0))

dirname $(readlink -f $0)

readlink -f $0

++++ readlink -f /tmp/snap/snap-install.sh

+++ dirname /tmp/snap/snap-install.sh

++ echo /tmp/snap

+ whereThisScriptIs=/tmp/snap

REINSTALL="no"

+ REINSTALL=no

echo $whereThisScriptIs

+ echo /tmp/snap

/tmp/snap

if [ "$1" == "reinstall" ]

then

        REINSTALL="yes"

fi

+ '[' -t == reinstall ']'

BOOTCONFIG=/boot/config

+ BOOTCONFIG=/boot/config

SNAPHOME=/boot/config/snap

+ SNAPHOME=/boot/config/snap

INSTALLTYPE='full' # full or update

+ INSTALLTYPE=full

INSTALLDIRECTORY=/tmp/snap

+ INSTALLDIRECTORY=/tmp/snap

 

if [ -f $whereThisScriptIs/snap.sh ] && [ "$whereThisScriptIs" != "$SNAPHOME" ]

then

        INSTALLDIRECTORY=$whereThisScriptIs

fi

+ '[' -f /tmp/snap/snap.sh ']'

+ '[' /tmp/snap '!= /boot/config/snap ]'

+ INSTALLDIRECTORY=/tmp/snap

PriorVersion=""

+ PriorVersion=

NewVersion=`$INSTALLDIRECTORY/snap.sh -v`

$INSTALLDIRECTORY/snap.sh -v

++ /tmp/snap/snap.sh -v

/tmp/snap/snap.sh: line 79: /boot/config/snap/snapCommon.sh: No such file or directory

+ NewVersion=

 

If I look again at /boot/config/snap it has a new set of files.

 

Sorry... but that is not a "test" only option.

 

Joe L.

 

 

 

 

Link to comment

Ok, here.  :)  Even though that button is the install button and it can't appear unless the download button has been clicked I can add this code so you can run it manually.  

 

#define USER_SCRIPT_TEST test -s /tmp/snap.newfiles &&  -d /tmp/snap && -f /tmp/snap/snap-install.sh && -f /tmp/snap/snapCommon.sh && echo "`/tmp/snap/snap-install.sh -t | tr '[:lower:]' '[:upper:]'` SNAP Updates"

 

 

EDIT:  Joe, I attached the buttons with the updated line above.

snap_user_script_buttons.zip

Link to comment

You say the -t option does not install anything... Wrong...

 

The -t option does only return a text string.  If your's is doing something else the you are running an older version of snap-install.sh that doesn't exist anymore.  It only existed for a few builds and you are the only person who ever saw it.  So in order to do a valid test you will have to get rid of it.

 

I just downloaded the tarball and here is the snap-install.sh code.

 

### snap-install.sh

### Dave Lewis

### Jan 21, 2010

 

usage()

{

cat << EOF

usage: $0 options

 

OPTIONS:

  -t      

  -i

  -r

EOF

}

if [ -z "$1" ]

then

usage

fi

 

function CheckIfSnapInstalled()

{

IS_SNAP_INSTALLED=0

PriorVersion=''

 

if [ -d $SNAPHOME ]  && [ -f $SNAPHOME/snap.sh ]

then

IS_SNAP_INSTALLED=1

fi

if [ $IS_SNAP_INSTALLED -eq 1 ]

then

# try to determine what version is already installed.

PriorVersion=`$SNAPHOME/snap.sh -v`

if [ -z "$PriorVersion" ]

then

#check if the snapEvents.sh file exist.

if [ -f $SNAPHOME/snapEvents.sh ]

then

PriorVersion='0.46'

else

PriorVersion='0.32' # an old version.

fi

fi

fi

 

}

 

function WhatPossibleAction()  #tests to see if install,update,reinstall possible.

{

if [ $IS_SNAP_INSTALLED -eq 1 ]

then

#what kind of action can be taken

if [ "$PriorVersion" == "$NewVersion" ]

then

PossibleAction='reinstall'

else

PossibleAction='update'

fi

else

PossibleAction='install'

fi

echo $PossibleAction

}

 

 

 

whereThisScriptIs="`echo $(dirname $(readlink -f $0))`"

BOOTCONFIG=/boot/config

SNAPHOME=/boot/config/snap

INSTALLDIRECTORY=/tmp/snap

 

while getopts rit option

do

 

       case "${option}"

       in

               r) ACTION='reinstall';REINSTALL="yes";;

i) ACTION='install';;

t) ACTION='test';;

               \?) usage

                   exit 1;;

       esac

 

done

 

if [ -f $whereThisScriptIs/snap.sh ] && [ "$whereThisScriptIs" != "$SNAPHOME" ]

then

INSTALLDIRECTORY=$whereThisScriptIs

fi

 

NewVersion=`$INSTALLDIRECTORY/snap.sh -v`

 

 

#cd $BOOTCONFIG

PATH=$PATH:./

#export PATH

echo `date` > /tmp/snap-install.log

#

# Is snap installed?

CheckIfSnapInstalled

#What possible action can be performed.

PossibleAction=$(WhatPossibleAction)

if [ "$ACTION" == "test" ]

then

echo $PossibleAction

exit 0

fi

 

-- There is more code but this shows that a -t exits from the install without doing anything but echoing text.  --

 

EDIT:  I have attached the buttons.

snap_user_script_buttons_01282011.zip

Link to comment

One of the new features in SNAP 0.47 is snap.sh -listDevInfo.  It's a improved version of the -listDeviceConfigurationInfo listing that highlights the serial number part of the device name.  This makes is a lot simplier to add new devices to snap.  The highlighted part is what you use when adding a drive to SNAP.  You still need to telnet to unRAID and use the command line but at least no more scratching your head trying to figure out what the serial number is supposed to be.  If you like seeing the /dev/disk/by-id/ prefix when you run it then include the snap.sh -listDevInfo long modifier.

 

snap.sh -listDevInfo

 

snap.sh -a [sharename] [serialnumber]

 

 

snap.sh-listDevInfo.png.eeea6944b0b3c5cd9b4a782d4f7bb2ec.png

Link to comment

Something that is not clear in the OP for 0.47 is the install procedure for non unMenu users. It might just be a wording thing.

 

No there isn't anything written up about that.  I can detail those procedures.  

 

 

How to install SNAP updates without unMenu.

Download the 0.47 version tar file from here.  Telnet to unRAID.  

 

cd /tmp

mkdir snap

 

Then copy the downloaded tar file to /tmp/snap directory.  

From Windows you can copy the tar file to \\tower\flash and then from your telnet connection the file will be in the /boot folder.

cp /boot/snap*.tgz /tmp/snap

 

 

Then extract the files from that tarball.

cd /tmp/snap

tar -xvf snap-0.47-build23.tgz

 

Test the installation before actually running it.

/tmp/snap/snap-install.sh -t

 

That will return a single word:  install or update or reinstall  

For install or update you will run:

/tmp/snap/snap-install.sh -i

 

For reinstall you will run:

/tmp/snap/snap-install.sh -r

 

There are not any user prompts during the installation.  And that's it.

Link to comment

After getting 4.7b1 up and running this month, I installed unMenu and manually installed Snap.

Got both working no problem a week ago.

 

Now I took another look at the OP and see instructions for 4.7 to install unMenu buttons.

I downloaded the zip (1 hour ago) as per the link, and continued with the next steps.

 

After going into unMenu and clicking on User Scripts, I pressed the button to "Check for SNAP updates"

It downloaded but showed an error at the bottom of the unMenu page.

The error is the same as the image posted by Joe L. except the error line is now 90.

 

The UPDATE Snap updates button shows up but has the error message as part of the button.

Clicking on that button results in the same button showing up but no error messages at the end of the page.

 

EDIT:

I copied /tmp/snap/snapCommons.sh to /boot/config/snap/

I clicked the UPDATE button again and got

Running /tmp/snap/snap-install.sh -i

New version of SNAP: 0.47

SNAP version 0.46 is currently installed.

No update required.

Sun Jan 30 21:33:22 MST 2011

No update required.

Installation was not run, all files are current.: Sun Jan 30 21:33:22 MST 2011

 

Link to comment

After getting 4.7b1 up and running this month, I installed unMenu and manually installed Snap.

Got both working no problem a week ago.

 

Now I took another look at the OP and see instructions for 4.7 to install unMenu buttons.

I downloaded the zip (1 hour ago) as per the link, and continued with the next steps.

 

After going into unMenu and clicking on User Scripts, I pressed the button to "Check for SNAP updates"

It downloaded but showed an error at the bottom of the unMenu page.

The error is the same as the image posted by Joe L. except the error line is now 90.

 

The UPDATE Snap updates button shows up but has the error message as part of the button.

Clicking on that button results in the same button showing up but no error messages at the end of the page.

 

EDIT:

I copied /tmp/snap/snapCommons.sh to /boot/config/snap/

I clicked the UPDATE button again and got

Running /tmp/snap/snap-install.sh -i

New version of SNAP: 0.47

SNAP version 0.46 is currently installed.

No update required.

Sun Jan 30 21:33:22 MST 2011

No update required.

Installation was not run, all files are current.: Sun Jan 30 21:33:22 MST 2011

 

 

Fixed in SNAP 0.47 build 25.

Also changes to the buttons so get them again.  

I was able to reproduce the error on line 90.  Thanks for reporting it.

snap-0.47-build25.tgz.zip

snap_user_script_buttons_01302011.zip

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.