rsuinux

Mise à jour systeme openwrt sur cubieboard.

Jan 4th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.03 KB | None | 0 0
  1. #!/bin/sh
  2. # ----------------------------------------
  3. #
  4. # Mise a jour complete du systeme, y compris
  5. # le noyau et les modules
  6. # ----------------------------------------
  7. # R. Suinot <[email protected]>
  8. # le 13/12/2014
  9. # revision: 01/01/2015 ! Happy New Year!
  10. # ----------------------------------------
  11.  
  12. commande=$1
  13.  
  14. NORMAL="\e[0m"
  15. GRAS="\e[1m"
  16. ROUGE="\e[31m"
  17.  
  18. OPKG="/bin/opkg"
  19. BASE="/root/"
  20. rep=$BASE`date +%d-%m-%Y`
  21. KERNEL="openwrt-sunxi-uImage"
  22. DTB="sun4i-a10-cubieboard.dtb"
  23. UENV="openwrt-sunxi-Cubieboard-uEnv.txt"
  24. BOOTD="/boot/dtb"
  25. BOOTU="/boot/uEnv.txt"
  26. BOOTK="/boot/uImage"
  27.  
  28. SAUVG="/root/sauvegarde_configurations"
  29. SAUVG1="/opt/home/borg/sauvegarde_configurations"
  30.  
  31. # pour test
  32. # opkg install --noaction --force-depends `update.sh | grep kmod`
  33.  
  34. if test -d "$rep" ; then
  35.         cd $rep
  36. else
  37.         /usr/local/sbin/recherche-uImage.sh
  38.         cd $rep
  39. fi
  40. if test -f $KERNEL && test -f $DTB && test -f $UENV ; then
  41.         echo "Sauvegarde configurations..."
  42.  
  43.         if test -d $SAUVG ; then
  44.                 echo "Repertoire deja present, mise a jour..."
  45.         else
  46.                 echo "Creation du repertoire de sauvegarde..."
  47.                 mkdir $SAUVG
  48.         fi
  49.         if test -d $SAUVG1 ; then
  50.                 echo "Second repertoire deja present, mise a jour..."
  51.         else
  52.                 echo "Creation du second repertoire de sauvegarde..."
  53.                 mkdir -p $SAUVG1
  54.         fi
  55.         echo "  ==> copie des fichiers et repertoires:"
  56.         echo "     ==> /etc/config "
  57.         cp -R /etc/config $SAUVG
  58.         cp -R /etc/config $SAUVG1
  59.         echo "     ==> /etc/crontabs "
  60.         cp -R /etc/crontabs $SAUVG
  61.         cp -R /etc/crontabs $SAUVG1
  62.         echo "     ==> /etc/samba "
  63.         cp -R /etc/samba $SAUVG
  64.         cp -R /etc/samba $SAUVG1
  65.         echo "     ==> /lib/firmware "
  66.         cp -R /lib/firmware $SAUVG
  67.         cp -R /lib/firmware $SAUVG1
  68.         echo "     ==> /etc/profile "
  69.         cp /etc/profile $SAUVG
  70.         cp /etc/profile $SAUVG1
  71.         echo "     ==> /etc/rc.local "
  72.         cp /etc/rc.local $SAUVG
  73.         cp /etc/rc.local $SAUVG1
  74.         echo "     ==> /etc/passwd "
  75.         cp /etc/passwd $SAUVG
  76.         cp /etc/passwd $SAUVG1
  77.         echo "     ==> /etc/shadow "
  78.         cp /etc/shadow $SAUVG
  79.         cp /etc/shadow $SAUVG1
  80.         echo "     ==> /etc/group "
  81.         cp /etc/group $SAUVG
  82.         cp /etc/group $SAUVG1
  83.         echo "     ==> /usr/local/ "
  84.         cp -R /usr/local $SAUVG
  85.         cp -R /usr/local $SAUVG1
  86.  
  87.         echo "Tous les fichiers de boot sont present. Installation en cours..."
  88.         cp $KERNEL $BOOTK
  89.         echo "kernel..."
  90.         cp $DTB $BOOTD
  91.         echo "dtb..."
  92.         cp $UENV $BOOTU
  93.         echo "uenv..."
  94.  
  95.         $OPKG install --force-depends `update.sh | grep kmod`
  96.         $OPKG install --force-depends `update.sh | grep kmod`
  97.  
  98.         echo -e "ok, mise a jour effectuee." $ROUGE "Reboot a faire!" $NORMAL
  99. else
  100.         echo -e $GRAS "erreur, manque un fichier de boot." $NORMAL
  101.     exit 1
  102. fi
  103. exit 0
Advertisement
Add Comment
Please, Sign In to add comment