diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in index e5fe800..b2ede0c 100644 --- a/UpdateRootfs.sh.in +++ b/UpdateRootfs.sh.in @@ -71,6 +71,43 @@ fi #echo ".." #echo "Update Firmware Done" #/root/gfa_spi -v +#================================ +#--create mountable run folder insted of link +RUNDIR=/run +if [ -L $RUNDIR ]; then + mv $RUNDIR $RUNDIR'_WRK' + mkdir $RUNDIR + mount -t tmpfs tmpfs $RUNDIR + WRKDIR=`pwd` + cd $RUNDIR'_WRK' + cp -a ./* $RUNDIR + cd $WRKDIR + rm $RUNDIR'_WRK' +fi +#--- craete missing nogroup group +GID_NOGROUP=`awk -F\: '/nogroup/ {print $3}' /etc/group` +if [ -z "$GID_NOGROUP" ]; then + addgroup -S -g 65534 nogroup +fi +#--create missing users for mysql, +if [ -z `awk -F\: '/mysql/ {print $3}' /etc/passwd` ]; then + UID_MY=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/passwd` + echo "mysql:x:$UID_MY:65534:MySQL daemon:/var/mysql:/bin/false" >> /etc/passwd +fi +#--create missing users for postgresql, +if [ -z `awk -F\: '/postgres/ {print $3}' /etc/passwd` ]; then + UID_PG=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/passwd` + GID_PG=`awk -F\: '/postgres/ {print $3}' /etc/group` + if [ -z "$GID_PG" ]; then + GID_PG=`awk -F: '{uid[$3]=1}END{for(x=1000; x<=1500; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group` + echo "postgres:x:$GID_PG:" >> /etc/group + fi + echo "postgres:x:$UID_PG:$GID_PG:PostgreSQL Server:/var/lib/pgsql:/bin/sh" >> /etc/passwd +fi +#------------------ +chown -Rv mysql:nogroup /var/mysql +chown -Rv postgres:postgres /var/lib/pgsql +#============================================================================== echo "Update Done, pls. reboot System" umount /mnt echo "."