How to build a SFS downloader and installer!
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.
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, 17:34, edited 3 times in total.
Maybe not what you are asking for but here is a script to download all sfs-files from a webpage:
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...
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).
Code: Select all
#!/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
Code: Select all
for X in *.sfs; do
#some call to load sfs ex:
otf_sfs_loader.sh $X
done
Last edited by goingnuts on Wed 29 Aug 2012, 04:31, edited 1 time in total.
Re: How to build a SFS downloader and installer?
Hello, oldyeller.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.
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
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
Re: How to build a SFS downloader and installer?
RSH wrote:Hello, oldyeller.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.
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.
This is what I am using
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?#!/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
Hi oldyeller,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?
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.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
How to build a SFS downloader and installer!
Hi oldyeller,
is this that what you want?
is this that what you want?
Code: Select all
#!/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
- Attachments
-
- sfsget-0.2.1.png
- (28.35 KiB) Downloaded 686 times
Last edited by L18L on Thu 30 Aug 2012, 17:02, edited 1 time in total.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
There is just one thing that I did notice when looking at both of these.L18L wrote:Glad to see it is useful and you like it
Not sure why this is like this any ideas?
I did look at the sfs file and the extension is sfs
- Attachments
-
- sfsget 0.2.1.jpg
- This is yours notice the .sf
- (86.92 KiB) Downloaded 618 times
-
- getsfs 0.2.jpg
- The sfs is ok with this one
- (68.59 KiB) Downloaded 425 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
missing s at the end of list
Thanks for the bug report
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
No idea why this happensoldyeller wrote:Not sure why this is like this any ideas?
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
- Attachments
-
- sfsget-0.2.2.png
- bug fix
- (12.49 KiB) Downloaded 598 times
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)
and (modified for .pet)
The result is: ---> LazY FReD 0.1!
RSH
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: Select all
AVSFS="` curl -s $NEWSERVER | awk -F '\"' '/href=\".*\.sfs/ {print $8}' | sort -f -u | tr '\n' ' ' | sed '$s/.$//' `"
Code: Select all
AVPET="` curl -s $NEWSERVER | awk -F '\"' '/href=\".*\.pet/ {print $8}' | sort -f -u | tr '\n' ' ' | sed '$s/.$//' `"
RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Hi, Oldyeller...
Setting an Icon in the TitleBar of YAD?
Code is in LazY Puppy 2.0.2 Final Buld 0.0.2 in file /usr/lib/package_creator_fs/package_creator at line 32. Parameter $WIcon is set in the locals.
Setting an Icon in the TitleBar of YAD?
Code is in LazY Puppy 2.0.2 Final Buld 0.0.2 in file /usr/lib/package_creator_fs/package_creator at line 32. Parameter $WIcon is set in the locals.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
Just do yourself a favor: drink some coffee or watch the news or anything else and wait a little...
I will upload LazY FReD 1.0.0 today/tonight. It has a lot of nice new features. One feature is to have multiple lists of server addresses (repos) and new lists can be created and added. It searches now for sfs, pet, iso, tar.gz, .gz, .tgz, .zip, .deb.
And lots more...
Aaahhh - have added around 140 server addresses that will work - right after installing 1.0.0 or loading the sfs.
I will upload LazY FReD 1.0.0 today/tonight. It has a lot of nice new features. One feature is to have multiple lists of server addresses (repos) and new lists can be created and added. It searches now for sfs, pet, iso, tar.gz, .gz, .tgz, .zip, .deb.
And lots more...
Aaahhh - have added around 140 server addresses that will work - right after installing 1.0.0 or loading the sfs.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]