Tools/ddrxupdates

From UIT
(Difference between revisions)
Jump to: navigation, search
(Blanked the page)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
{{public}}
 
  
= Automagic fetch + execute trusted remote scripts =
 
== Script ==
 
Update DEST and REMOTE_URL as necessary
 
<source lang='bash'>
 
#!/bin/bash
 
#
 
# Update script
 
#
 
# * This script will fetch update scripts from REMOTE_URL
 
# * Update scripts should be named 0.sh.asc, 1.sh.asc, ...
 
# * The file LAST in DEST will hold the last script downloaded regardless of the success of execution
 
 
DEST=/usr/share/heivs/heivsupdate
 
REMOTE_URL='http://wiki.hevs.ch/uit/index.php5?title=Tools/ddrxupdates/'
 
REMOTE_URL_END='&action=raw'
 
mkdir -p $DEST
 
cd $DEST
 
 
# The file named LAST will hold the last update number
 
# Create it if it does not exist
 
#
 
if [ ! -e LAST ]
 
then
 
CURRENT=0
 
echo -n $CURRENT > LAST
 
fi
 
CURRENT=`cat LAST`
 
 
while [ 1 ]
 
do
 
wget -q "$REMOTE_URL$CURRENT.sh.asc$REMOTE_URL_END" -O $CURRENT.sh.asc
 
if [ ! -e $CURRENT.sh.asc ] || [ ! -s  $CURRENT.sh.asc ]
 
then
 
echo nothing new
 
exit 0
 
fi
 
 
gpg -q --decrypt --output $CURRENT.sh $CURRENT.sh.asc  &> /dev/null
 
if [ $? -ne 0 ]
 
then
 
echo signature invalid
 
echo signature invalid >> $CURRENT.log
 
else
 
echo signature valid >> $CURRENT.log
 
chmod +x $CURRENT.sh
 
echo running ./$CURRENT.sh >> $CURRENT.log
 
./$CURRENT.sh >> $CURRENT.log
 
fi
 
 
rm $CURRENT.sh.asc $CURRENT.sh
 
 
((CURRENT++))
 
echo -n $CURRENT > LAST
 
done
 
 
 
</source>
 
 
[[Tools/ddrxupdates/0.sh.asc]]
 
[[Tools/ddrxupdates/1.sh.asc]]
 

Latest revision as of 10:22, 30 August 2013

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox