Commit e9369b5c authored by Franco Fichtner's avatar Franco Fichtner

rc: defer recover for packages to avoid database duplication

parent b205780f
...@@ -61,8 +61,8 @@ else ...@@ -61,8 +61,8 @@ else
done done
fi fi
# regenerate groups and users # regenerate groups and users for base
/usr/local/etc/rc.recover > /dev/null /usr/local/etc/rc.recover base > /dev/null
# rewrite message of the day # rewrite message of the day
/etc/rc.d/motd onestart /etc/rc.d/motd onestart
...@@ -169,6 +169,9 @@ fi ...@@ -169,6 +169,9 @@ fi
echo "done." echo "done."
# regenerate groups and users for packages
/usr/local/etc/rc.recover pkg > /dev/null
# Recreate capabilities DB # Recreate capabilities DB
/usr/bin/cap_mkdb /etc/login.conf /usr/bin/cap_mkdb /etc/login.conf
......
...@@ -148,12 +148,31 @@ function recover_rebuild() ...@@ -148,12 +148,31 @@ function recover_rebuild()
passthru('/bin/sync'); passthru('/bin/sync');
} }
/* first stage recovers the base system state */ function recover_base()
file_put_contents('/etc/group', $etc_group); {
file_put_contents('/etc/master.passwd', $etc_master_passwd); file_put_contents('/etc/group', $etc_group);
file_put_contents('/etc/shells', $etc_shells); file_put_contents('/etc/master.passwd', $etc_master_passwd);
recover_rebuild(); file_put_contents('/etc/shells', $etc_shells);
recover_rebuild();
/* second stage recovers the ports system state */ }
recover_ports();
recover_rebuild(); function recover_pkg()
{
recover_ports();
recover_rebuild();
}
$stage = isset($argv[1]) ? $argv[1] : 'both';
switch ($stage) {
case 'base':
recover_base();
break;
case 'pkg':
recover_pkg();
break;
default:
recover_base();
recover_pkg();
break;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment