GfA-buildroot_mysql_posgres_update_fixes.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in
  2. index e5fe800..b2ede0c 100644
  3. --- a/UpdateRootfs.sh.in
  4. +++ b/UpdateRootfs.sh.in
  5. @@ -71,6 +71,43 @@ fi
  6. #echo ".."
  7. #echo "Update Firmware Done"
  8. #/root/gfa_spi -v
  9. +#================================
  10. +#--create mountable run folder insted of link
  11. +RUNDIR=/run
  12. +if [ -L $RUNDIR ]; then
  13. + mv $RUNDIR $RUNDIR'_WRK'
  14. + mkdir $RUNDIR
  15. + mount -t tmpfs tmpfs $RUNDIR
  16. + WRKDIR=`pwd`
  17. + cd $RUNDIR'_WRK'
  18. + cp -a ./* $RUNDIR
  19. + cd $WRKDIR
  20. + rm $RUNDIR'_WRK'
  21. +fi
  22. +#--- craete missing nogroup group
  23. +GID_NOGROUP=`awk -F\: '/nogroup/ {print $3}' /etc/group`
  24. +if [ -z "$GID_NOGROUP" ]; then
  25. + addgroup -S -g 65534 nogroup
  26. +fi
  27. +#--create missing users for mysql,
  28. +if [ -z `awk -F\: '/mysql/ {print $3}' /etc/passwd` ]; then
  29. + UID_MY=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/passwd`
  30. + echo "mysql:x:$UID_MY:65534:MySQL daemon:/var/mysql:/bin/false" >> /etc/passwd
  31. +fi
  32. +#--create missing users for postgresql,
  33. +if [ -z `awk -F\: '/postgres/ {print $3}' /etc/passwd` ]; then
  34. + UID_PG=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/passwd`
  35. + GID_PG=`awk -F\: '/postgres/ {print $3}' /etc/group`
  36. + if [ -z "$GID_PG" ]; then
  37. + GID_PG=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group`
  38. + echo "postgres:x:$GID_PG:" >> /etc/group
  39. + fi
  40. + echo "postgres:x:$UID_PG:$GID_PG:PostgreSQL Server:/var/lib/pgsql:/bin/sh" >> /etc/passwd
  41. +fi
  42. +#------------------
  43. +chown -Rv mysql:nogroup /var/mysql
  44. +chown -Rv postgres:postgres /var/lib/pgsql
  45. +#==============================================================================
  46. echo "Update Done, pls. reboot System"
  47. umount /mnt
  48. echo "."