Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # ----------------------------------------
- #
- # Mise a jour complete du systeme, y compris
- # le noyau et les modules
- # ----------------------------------------
- # R. Suinot <[email protected]>
- # le 13/12/2014
- # revision: 01/01/2015 ! Happy New Year!
- # ----------------------------------------
- commande=$1
- NORMAL="\e[0m"
- GRAS="\e[1m"
- ROUGE="\e[31m"
- OPKG="/bin/opkg"
- BASE="/root/"
- rep=$BASE`date +%d-%m-%Y`
- KERNEL="openwrt-sunxi-uImage"
- DTB="sun4i-a10-cubieboard.dtb"
- UENV="openwrt-sunxi-Cubieboard-uEnv.txt"
- BOOTD="/boot/dtb"
- BOOTU="/boot/uEnv.txt"
- BOOTK="/boot/uImage"
- SAUVG="/root/sauvegarde_configurations"
- SAUVG1="/opt/home/borg/sauvegarde_configurations"
- # pour test
- # opkg install --noaction --force-depends `update.sh | grep kmod`
- if test -d "$rep" ; then
- cd $rep
- else
- /usr/local/sbin/recherche-uImage.sh
- cd $rep
- fi
- if test -f $KERNEL && test -f $DTB && test -f $UENV ; then
- echo "Sauvegarde configurations..."
- if test -d $SAUVG ; then
- echo "Repertoire deja present, mise a jour..."
- else
- echo "Creation du repertoire de sauvegarde..."
- mkdir $SAUVG
- fi
- if test -d $SAUVG1 ; then
- echo "Second repertoire deja present, mise a jour..."
- else
- echo "Creation du second repertoire de sauvegarde..."
- mkdir -p $SAUVG1
- fi
- echo " ==> copie des fichiers et repertoires:"
- echo " ==> /etc/config "
- cp -R /etc/config $SAUVG
- cp -R /etc/config $SAUVG1
- echo " ==> /etc/crontabs "
- cp -R /etc/crontabs $SAUVG
- cp -R /etc/crontabs $SAUVG1
- echo " ==> /etc/samba "
- cp -R /etc/samba $SAUVG
- cp -R /etc/samba $SAUVG1
- echo " ==> /lib/firmware "
- cp -R /lib/firmware $SAUVG
- cp -R /lib/firmware $SAUVG1
- echo " ==> /etc/profile "
- cp /etc/profile $SAUVG
- cp /etc/profile $SAUVG1
- echo " ==> /etc/rc.local "
- cp /etc/rc.local $SAUVG
- cp /etc/rc.local $SAUVG1
- echo " ==> /etc/passwd "
- cp /etc/passwd $SAUVG
- cp /etc/passwd $SAUVG1
- echo " ==> /etc/shadow "
- cp /etc/shadow $SAUVG
- cp /etc/shadow $SAUVG1
- echo " ==> /etc/group "
- cp /etc/group $SAUVG
- cp /etc/group $SAUVG1
- echo " ==> /usr/local/ "
- cp -R /usr/local $SAUVG
- cp -R /usr/local $SAUVG1
- echo "Tous les fichiers de boot sont present. Installation en cours..."
- cp $KERNEL $BOOTK
- echo "kernel..."
- cp $DTB $BOOTD
- echo "dtb..."
- cp $UENV $BOOTU
- echo "uenv..."
- $OPKG install --force-depends `update.sh | grep kmod`
- $OPKG install --force-depends `update.sh | grep kmod`
- echo -e "ok, mise a jour effectuee." $ROUGE "Reboot a faire!" $NORMAL
- else
- echo -e $GRAS "erreur, manque un fichier de boot." $NORMAL
- exit 1
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment