Author |
Message |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Mon 27 Aug 2012, 20:10 Post subject:
How to build a SFS downloader and installer! |
|
I beleive that I can do the GUI for this just don't know the code for downloading and installing.
This is what I want to do. I would like to upload all the sfs on my ov-precise threads so that they wil all be in one place and therfore can be downloaded.
I have learned a liitle about GTKdailog but really don't know anything about bash or any of the others.
Last edited by oldyeller on Wed 29 Aug 2012, 13:34; edited 3 times in total
|
Back to top
|
|
 |
goingnuts
Joined: 07 Dec 2008 Posts: 922
|
Posted: Tue 28 Aug 2012, 14:16 Post subject:
|
|
Maybe not what you are asking for but here is a script to download all sfs-files from a webpage:
Code: | #!/bin/sh
wget -nd -r -A sfs http://the_target_webpage.html
#-nd = --no-directories (all files are saved in the current directory
#-r = --recursive
#-A sfs = --accept sfs
#if you would download all images instead use:
#wget -nd -r -A jpeg,jpg,bmp,gif,png http://the_target_webpage.html |
For the install afterwards you could use sfs_load-1.9.6 on-the-fly or otf_sfs_loader.sh looping through the downloaded sfs-files...
Code: | for X in *.sfs; do
#some call to load sfs ex:
otf_sfs_loader.sh $X
done |
NB: remember that sfs-files must be placed outside the current unionfs branch (could be in /tmp or somewhere on your save-file partition /home).
Last edited by goingnuts on Wed 29 Aug 2012, 00:31; edited 1 time in total
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 2420 Location: Germany
|
Posted: Tue 28 Aug 2012, 14:40 Post subject:
Re: How to build a SFS downloader and installer? Subject description: Need help |
|
oldyeller wrote: | I beleive that I can do the GUI for this just don't know the code for downloading and installing.
This is what I want to do. I would like to upload all the sfs on my ov-precise threads so that they wil all be in one place and therfore can be downloaded.
I have learned a liitle about GTKdailog but really don't know anything about bash or any of the others. |
Hello, oldyeller.
You can find everything you will need for a feature like this in LazY Puppy. Just have a look at the Run-Scripts in /root/.my-sfs-scripts and/or at the Scripts for the SFS-Suites in /usr/sbin/ceelab/lazy-sfs-load
LazY Puppy tries to run a application. If the application is not available, it tries to load the sfs. If the sfs is not available, it tries to download the sfs from smokey01.com. After a successful download, LazY Puppy loads the sfs (using sfs_load) and after this the application starts (this is what the automatically generated Run-Scripts are doing).
Greetings,
RSH
_________________ LazY Puppy
RSH's DNA
SARA B.
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Tue 28 Aug 2012, 16:30 Post subject:
Re: How to build a SFS downloader and installer? Subject description: Need help |
|
RSH wrote: | oldyeller wrote: | I beleive that I can do the GUI for this just don't know the code for downloading and installing.
This is what I want to do. I would like to upload all the sfs on my ov-precise threads so that they wil all be in one place and therfore can be downloaded.
I have learned a liitle about GTKdailog but really don't know anything about bash or any of the others. |
Hello, oldyeller.
You can find everything you will need for a feature like this in LazY Puppy. Just have a look at the Run-Scripts in /root/.my-sfs-scripts and/or at the Scripts for the SFS-Suites in /usr/sbin/ceelab/lazy-sfs-load
LazY Puppy tries to run a application. If the application is not available, it tries to load the sfs. If the sfs is not available, it tries to download the sfs from smokey01.com. After a successful download, LazY Puppy loads the sfs (using sfs_load) and after this the application starts (this is what the automatically generated Run-Scripts are doing).
Greetings,
RSH |
Thanks RSH I will take a look I really like what you did with LaYzPuppy awesome job.
goingnuts thanks but not what I was looking for.
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Wed 29 Aug 2012, 13:38 Post subject:
|
|
This is what I am using
Quote: |
#!/bin/bash
### .sfs downloader ###
### stu90 ###
### root password for user fido ###
[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}
TESTSERVER="174.132.189.156"
SERVER="www.smokey01.com/Oldyeller/pet_packages-upup/"
## test server ##
ping -4 -c 1 "$TESTSERVER"
if [[ "$?" == "1" ]]; then
yaf-splash -placement center -bg yellow -fontsize large -timeout 10 -text "Either your Internet connection is not working, or the primary repository is down. Aborting SFS Downloader" &
exit 1
fi
## default download location ##
if [[ -f /etc/rc.d/PUPSTATE ]]; then
PUPPYSFS="/mnt/home/`grep 'PUPSFS' /etc/rc.d/PUPSTATE | cut -d '/' -f 2`"
fi
## action for first run with out save file ##
if [[ ! -d "$PUPPYSFS" ]]; then
## get available partitions ##
AVPART="`probepart -m | grep -v -E 'none|iso9660|swap' | cut -f 1 -d '|' | cut -f 3 -d '/' | tr '\n' '!' | sed '$s/.$//'`"
## mount partition info and gui ##
TEXT1=" This is a first boot of Puppy and you have not yet saved a session. \n You want to download the .sfs package, and this needs to be downloaded \n to the same partition in which you will be creating the session save-file.
\n Here is a list of suitable partitions. Whichever one you choose, at \n shutdown you will be asked to save the session and be sure to choose the \n same partition - please select a partition to mount from the box below: "
MNTPART=$(yad --title="$TITLE $VER" --text="$TEXT1" --form --field="mount partition:CB" "$AVPART" \
--button="gtk-quit:1" --button="gtk-ok:0")
result=$?
if [[ "$MNTPART" = "" ]]; then
echo "Exiting" && exit
fi
case $result in
0)
GETMNT=`echo $MNTPART | cut -d '|' -f 1`
## mount selected partition ##
if [[ ! -d /mnt/"$GETMNT" ]];then
mkdir -p /mnt/"$GETMNT"
mount /dev/"$GETMNT" /mnt/"$GETMNT"
fi
if [ $? -ne 0 ];then
xmessage -bg red -center "ERROR: Could not mount /dev/"$GETMNT", aborting"
exit 1
else
## set mounted partition as download location ##
PUPPYSFS="/mnt/"$GETMNT""
fi
;;
1)
echo "cancel pressed exiting"
exit
;;
esac
fi
## .sfs selection gui ##
## gui info ##
TITLE="Ov-Precise Get .sfs"
VER="0.2"
TEXT=" Please choose the .sfs packages that you would like to download from the drop down box below."
## get available .sfs on server ##
AVSFS="` curl -s $SERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | tr '\n' '!' | sed '$s/.$//' `"
LISTSFS=$(yad --title="$TITLE $VER" --text --justify=center --text="$TEXT" --form \
--field="Available sfs":CB "$AVSFS" \
--field="Download to":DIR "$PUPPYSFS" \
--button="gtk-quit:1" --button="gtk-ok:0")
result=$?
[[ $result = 1 ]] && echo "Exiting" && exit
case $result in
0)
GETSFS=`echo $LISTSFS | cut -d '|' -f 1`
GETLOC=`echo $LISTSFS | cut -d '|' -f 2`
## move to .sfs download location ##
cd "$GETLOC"
## check if .sfs exists in download location ##
if [ -f "$GETLOC/$GETSFS" ]; then
yaf-splash -placement center -bg yellow -close never -fontsize large -timeout 10 -text "$GETSFS already exists - aborting connection" &
exit 1
else
## download .sfs - could do with some error check here ##
yaf-splash -placement center -bg yellow -close never -fontsize large -text "Please wait, downloading .sfs..." &
YPID=$!
TERMSET="urxvt -fg green -bg black -geometry 65x10+0+0 +sb -e "
$TERMSET wget -c "$SERVER/$GETSFS"
kill $YPID
fi
## load .sfs ##
if [ "$GETLOC" == "/mnt/home/$PUPPYSFS" ];then
yaf-splash -placement center -bg green -fontsize large -timeout 10 -text "$SFSGET download complete - load .sfs now..." &
sfs_load "${GETSFS}" &
echo "exit" && exit 0
else
yaf-splash -placement center -bg green -fontsize large -timeout 10 -text "$SFSGET download complete - load .sfs now..." &
sfs_load "${GETSFS}" &
echo "exit" && exit 0
fi
;;
1)
echo "cancel pressed exiting"
exit
;;
esac
|
would I be able to improve on this. Like not having a dropdown list but a scroll bar with the list? or is this better?
|
Back to top
|
|
 |
stu91

Joined: 06 Aug 2012 Posts: 145 Location: England. Dpup. Dell Inspiron 1501
|
Posted: Thu 30 Aug 2012, 07:01 Post subject:
|
|
oldyeller wrote: |
would I be able to improve on this. Like not having a dropdown list but a scroll bar with the list? or is this better? |
Hi oldyeller,
I do not think it is possible to have the download to option available when using --list --column ( sroll bar ) to display available .sfs files.
For a list of different Yad options run command: yad --help-all
cheers.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3450 Location: www.eussenheim.de/
|
Posted: Thu 30 Aug 2012, 08:22 Post subject:
How to build a SFS downloader and installer! |
|
Hi oldyeller,
is this that what you want?
Code: | #!/bin/bash
### .sfs downloader ###
### stu90 ###
# 20120830 hacked by L18L for oldyeller
# Separate dialog "Preferences" for location where to download
# SFS files in a list with scroll bar
# version 0.2.1
### root password for user fido ###
[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@}
TESTSERVER="174.132.189.156"
SERVER="www.smokey01.com/Oldyeller/pet_packages-upup/"
## test server ##
ping -4 -c 1 "$TESTSERVER"
if [[ "$?" == "1" ]]; then
yaf-splash -placement center -bg yellow -fontsize large -timeout 10 -text "Either your Internet connection is not working, or the primary repository is down. Aborting SFS Downloader" &
exit 1
fi
## default download location ##
if [[ -f /etc/rc.d/PUPSTATE ]]; then
PUPPYSFS="/mnt/home/`grep 'PUPSFS' /etc/rc.d/PUPSTATE | cut -d '/' -f 2`"
fi
## action for first run with out save file ##
if [[ ! -d "$PUPPYSFS" ]]; then
## get available partitions ##
AVPART="`probepart -m | grep -v -E 'none|iso9660|swap' | cut -f 1 -d '|' | cut -f 3 -d '/' | tr '\n' '!' | sed '$s/.$//'`"
## mount partition info and gui ##
TEXT1=" This is a first boot of Puppy and you have not yet saved a session. \n You want to download the .sfs package, and this needs to be downloaded \n to the same partition in which you will be creating the session save-file.
\n Here is a list of suitable partitions. Whichever one you choose, at \n shutdown you will be asked to save the session and be sure to choose the \n same partition - please select a partition to mount from the box below: "
MNTPART=$(yad --title="$TITLE $VER" --text="$TEXT1" --form --field="mount partition:CB" "$AVPART" \
--button="gtk-quit:1" --button="gtk-ok:0")
result=$?
if [[ "$MNTPART" = "" ]]; then
echo "Exiting" && exit
fi
case $result in
0)
GETMNT=`echo $MNTPART | cut -d '|' -f 1`
## mount selected partition ##
if [[ ! -d /mnt/"$GETMNT" ]];then
mkdir -p /mnt/"$GETMNT"
mount /dev/"$GETMNT" /mnt/"$GETMNT"
fi
if [ $? -ne 0 ];then
xmessage -bg red -center "ERROR: Could not mount /dev/"$GETMNT", aborting"
exit 1
else
## set mounted partition as download location ##
PUPPYSFS="/mnt/"$GETMNT""
fi
;;
1)
echo "cancel pressed exiting"
exit
;;
esac
fi
## .sfs selection gui ##
## gui info ##
TITLE="Ov-Precise Get .sfs"
VER="0.2.1"
function getloc() {
GETLOC=$(echo "$AVSFS" | sed -r s%!%\n% | \
yad --title="$TITLE $VER Preferences" --width="300" --justify=center \
--form --field="Download to":DIR "$PUPPYSFS" \
)
result=$?
case $result in
1|252) exit ;;
0) GETLOC=${GETLOC%%|*} # cut -d '|' -f1
esac
}
while true; do # endless loop
[ "$GETLOC" ] || getloc # if $GETLOC is not set then set it
##move "Download to" Preferences
#GETLOC=$(echo "$AVSFS" | sed -r s%!%\n% | \
# yad --title="$TITLE $VER" --text --justify=center --text="$TEXT" \
# --form --field="Download to":DIR "$PUPPYSFS" \
# )
#result=$?
#GETLOC=${GETLOC%%|*}
#echo result=$result
#case $result in
# 1|252) exit;;
# 0) GETLOC=${GETLOC%%|*} # cut -d '|' -f1
#esac
#TEXT=" Please choose the .sfs packages that you would like to download from the drop down box below."
## get available .sfs on server ##
#AVSFS="` curl -s $SERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | tr '\n' '!' | sed '$s/.$//' `"
#LISTSFS=$(yad --title="$TITLE $VER" --text --justify=center --text="$TEXT" --form \
#--field="Available sfs":CB "$AVSFS" \
#--field="Download to":DIR "$PUPPYSFS" \
#--button="gtk-quit:1" --button="gtk-ok:0")
TEXT=" Please choose the .sfs packages that you would like to download from the list below.
Download to ${GETLOC} (Can be changed in Preferences) "
AVSFS="` curl -s $SERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | sed '$s/.$//' `"
LISTSFS=$(echo "$AVSFS" | sed -r s%!%\n% | \
yad --title="$TITLE $VER" --text --justify=center --text="$TEXT" --height="220" \
--list --column="Available sfs":2 \
--button="gtk-preferences":3 \
--button="gtk-quit:1" --button="gtk-ok:0")
result=$?
case $result in
1|252) echo "Exiting" && exit ;;
3) getloc ;;
0)
GETSFS=`echo $LISTSFS | cut -d '|' -f 1`
## move to .sfs download location ##
cd "$GETLOC"
## check if .sfs exists in download location ##
if [ -f "$GETLOC/$GETSFS" ]; then
yaf-splash -placement center -bg yellow -close never -fontsize large -timeout 10 -text "$GETSFS already exists - aborting connection" &
exit 1
else
## download .sfs - could do with some error check here ##
yaf-splash -placement center -bg yellow -close never -fontsize large -text "Please wait, downloading .sfs..." &
YPID=$!
TERMSET="urxvt -fg green -bg black -geometry 65x10+0+0 +sb -e "
$TERMSET wget -c "$SERVER/$GETSFS"
kill $YPID
fi
## load .sfs ##
if [ "$GETLOC" == "/mnt/home/$PUPPYSFS" ];then
yaf-splash -placement center -bg green -fontsize large -timeout 10 -text "$SFSGET download complete - load .sfs now..." &
sfs_load "${GETSFS}" &
echo "exit" && exit 0
else
yaf-splash -placement center -bg green -fontsize large -timeout 10 -text "$SFSGET download complete - load .sfs now..." &
sfs_load "${GETSFS}" &
echo "exit" && exit 0
fi
;;
esac
done
|
 |
Description |
|
Filesize |
28.35 KB |
Viewed |
681 Time(s) |

|
Last edited by L18L on Thu 30 Aug 2012, 13:02; edited 1 time in total
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Thu 30 Aug 2012, 12:22 Post subject:
|
|
Hi L18L,
That will workout just fine. This will be nice once I have Manna-002 out.
Cheers.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3450 Location: www.eussenheim.de/
|
Posted: Thu 30 Aug 2012, 13:07 Post subject:
|
|
Glad to see it is useful and you like it
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Thu 30 Aug 2012, 14:52 Post subject:
|
|
L18L wrote: | Glad to see it is useful and you like it  |
There is just one thing that I did notice when looking at both of these.
Not sure why this is like this any ideas?
I did look at the sfs file and the extension is sfs
Description |
This is yours notice the .sf |
Filesize |
86.92 KB |
Viewed |
613 Time(s) |

|
Description |
The sfs is ok with this one |
Filesize |
68.59 KB |
Viewed |
420 Time(s) |

|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3450 Location: www.eussenheim.de/
|
Posted: Fri 31 Aug 2012, 05:04 Post subject:
missing s at the end of list Subject description: simple work around |
|
Thanks for the bug report
oldyeller wrote: | Not sure why this is like this any ideas? |
No idea why this happens
but a simple workaround is: just append a s to the list of available sfs (AVSFS)
# 20120831 appending missing s to AVSFS
# version 0.2.2
#AVSFS="` curl -s $SERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | sed '$s/.$//' `" # 20120831
AVSFS="` curl -s $SERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | sed '$s/.$//' `s" # 20120831
Description |
bug fix |
Filesize |
12.49 KB |
Viewed |
593 Time(s) |

|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Fri 31 Aug 2012, 11:31 Post subject:
|
|
L18L
thanks for your help on this that worked out just fine.
I added a note for the fix.
I some point I will learn how to do code myself
Cheers
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 2420 Location: Germany
|
Posted: Fri 31 Aug 2012, 19:00 Post subject:
|
|
Hi.
Again a useful script by stu90.
Again i "found" it from a post of oldyeller.
Again i could not resist to make a useful and comfortable tool by this inspiration.
Again i did learn something.
What i did use from the script (i do not know such commands and do wish, i would have the bash knowledge of stu90), is:
(already modified for sfs)
Code: | AVSFS="` curl -s $NEWSERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | tr '\n' ' ' | sed '$s/.$//' `" |
and (modified for .pet)
Code: | AVPET="` curl -s $NEWSERVER | awk -F '\"' '/href=\".*\.pet/ {print $8}' | sort -f -u | tr '\n' ' ' | sed '$s/.$//' `" |
The result is: ---> LazY FReD 0.1!
RSH
_________________ LazY Puppy
RSH's DNA
SARA B.
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Fri 31 Aug 2012, 20:14 Post subject:
|
|
Very nice
I will take a look and check it out.
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 891 Location: Alaska
|
Posted: Sat 01 Sep 2012, 12:07 Post subject:
|
|
stu91 or L18L,
How do I put an icon on the bar?
|
Back to top
|
|
 |
|