writes one line into the text file '.../build-script.sh'. If i use this command again the text file '.../build-script.sh' will be deleted and the new line is written in the new text file '.../build-script.sh'.
How can i get multiple lines into the same text file?
Another solution would be something like this using cat instead of echo :
# cat >>file.ext <<EOT
> #!/bin/sh
> echo "$0 START"
> echo "Now doing some code here"
> echo "$0" END
> EOT
# cat file.ext
#!/bin/sh
echo "/bin/bash START"
echo "Now doing some code here"
echo "/bin/bash" END
#
Karl Godt wrote:Another solution would be something like this using cat instead of echo :
# cat >>file.ext <<EOT
> #!/bin/sh
> echo "$0 START"
> echo "Now doing some code here"
> echo "$0" END
> EOT
# cat file.ext
#!/bin/sh
echo "/bin/bash START"
echo "Now doing some code here"
echo "/bin/bash" END
#
hi everyone,
i'm sorry where to put my question, i hope in this thread is ok.
i finished download aqualung with ppm, and it was installed on my laptop.
now, i look at /root/.package/aqualung-0.9b11-Lucid.files there are many rows representating the file i download.
it's like this:
actually, i can put them one by one. but if there are some script, it can be more fast and interesting.
how to repackage again in a pet or a folder with a script? so i don't need download that aqualung again.
thanks
recobayu wrote:hi everyone,
i'm sorry where to put my question, i hope in this thread is ok.
i finished download aqualung with ppm, and it was installed on my laptop.
now, i look at /root/.package/aqualung-0.9b11-Lucid.files there are many rows representating the file i download.
it's like this:
actually, i can put them one by one. but if there are some script, it can be more fast and interesting.
how to repackage again in a pet or a folder with a script? so i don't need download that aqualung again.
thanks
Hello,
I dont believe that is a complete list, as the binaries etc are not listed..
Add them all before making a pet..
Anyone want to help with a script to read the final /* lines in any /root/.packages file, then copy the actual files to a dir...
RePet-1.0
I cant remember how to get cat to ignore things...
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!
cat>logtest.sh <<EndOfText
exec 1>>logfile.log 2>>error.log
echo 'DBG : what i wanna say here'
EndOfText
source logtest.sh &
sleep 1
cat logfile.log
cat error.log
which is the simpliest solution as far as i can tell (look into /etc/rc.d/rc.sysinit for an example [ "$LOGLEVEL" ] || exec 1>/tmp/bootsysinit.log 2>&1 ) .
I refined newpet a bit to read the original pet.specs and make the duplicate without having to repeat the gui building process; also added a few features like searching for the correct name so it's not necessary to remember the exact title; also added cleanup, help menu, and Xdialog notice that the pet is in /tmp .
edit. Added option to update version, "newpet [package] [newname]"
edit2: Removed a tgz2pet related bug.
#!/bin/sh
## creates a new pet in /tmp of files listed in /root/.package
if [ ! "$1" -o "$1" == "-h" ]; then
echo 'USEAGE: newpet [package] [newname]
creates new pet in /tmp
add [newname] for updating version'
exit
fi
NAME="$(ls /root/.packages | grep -m1 -i "$1" | sed 's/.files//')"
if [ ! -f /root/.packages/${NAME}.files ]; then
echo "package doesn't exist"
exit
fi
[ -d /tmp/"$NAME" ] && rm -r /tmp/"$NAME"
mkdir /tmp/"$NAME"
for i in `cat /root/.packages/${NAME}.files`; do
echo "$i" >> /tmp/list
done
while read line; do
if [ -f $line ]; then
DIR="$(dirname ${line})"
[ -d /tmp/${NAME}${DIR} ] || mkdir -p /tmp/${NAME}${DIR}
cp -p "$line" /tmp/${NAME}${DIR}
fi
done </tmp/list
cat /root/.packages/user-installed-packages | grep -m1 "$NAME" >>/tmp/${NAME}/pet.specs
## Make pet
cd /tmp
## create new name (if $2 )
if [ "$2" ]; then
## edit pet.specs
SPECS="${NAME}/pet.specs"
sed -i "s/${NAME}.pet/${2}.pet/" ./"$SPECS"
newver="$(echo "$2" | tr -cd '0-9.')"
oldver="$(cat ${SPECS} | cut -d\| -f3)"
sed -i "s/|${oldver}|/|${newver}|/" ./"$SPECS"
field1="$(cat ${SPECS} | cut -d\| -f1)"
sed -i "s/${field1}/${2}/" ./"$SPECS"
NEWNAME="$2"
mv ./$NAME ./$NEWNAME
NAME="$NEWNAME"
fi
tar -czf ./${NAME}.tgz ./"$NAME"
tgz2pet ./${NAME}.tgz
if [ -f ${NAME}.pet ]; then
Xdialog --msgbox "${NAME}.pet created in /tmp" 5 35
fi
## Cleanup
[ -d /tmp/${NAME} ] && rm -r /tmp/${NAME}
[ -f /tmp/list ] && rm -r /tmp/list
Last edited by jpeps on Mon 12 Dec 2011, 05:50, edited 2 times in total.
Hello,
@jpeps,
Yea, like that..
Your script is a bit above me, but if I omit the .files when I call it it works great.
As a test I pulled xfce4 back outta Lupen...
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!
puppyluvr wrote:
Your script is a bit above me, but if I omit the .files when I call it it works great.
Yeah..just put in the package name without any".files" extension. The first arg is just a search word anyway, so if you get close it should find the correct package.
example..to update:
"newpet traymanager TrayManager-4.6"
or just:
"newpet traymanager"
for a copy
I just edited it a bit to make the searches in pet.specs a little more specific; also, tgz2pet related bug for updating pets
I really don't like using the terminal very much (except in programming processes) and so i did a little work on the first script of jpeps to use this one by a GUI or similar with right-click-action.
I have made a .pet for both of use. Both have language support for english and german.
Here's one with a gtkdialog front-end. Select a package from the drop down menu, and then push the "make pet" button for a copy. If you enter a new name, it will make a new version. There's also a button for viewing the files for a selected package.