blob: c1ccd7b1b2f161a434d69ce34477f19ddfec9b5d (
plain) (
tree)
|
|
patch_profile() {
if grep -q "/root/installer/firstrun.sh" /root/.profile; then
echo "# first_run script already in root's .profile, doing nothing."
else
echo "# Patching root's .profile"
echo "/root/installer/firstrun.sh" >> /root/.profile
fi
}
drop_script() {
mkdir -p "/root/installer"
# So we know all the paths and the mysql password
cat "${BASEDIR}/includes/00-dirs.inc" "${CONFIGDIR}/config" > "/root/installer/config"
chmod 0600 "/root/installer/config"
cp "${BASEDIR}/static_files/firstrun_script.sh" "/root/installer/firstrun.sh"
chmod u+x "/root/installer/firstrun.sh"
}
drop_keychanger_rclocal() {
if grep -q "Deleting old ssh keys" /etc/rc.local; then
echo "# ssh key changer already in rc.local; doing nothing."
else
echo
echo "# Patching rc.local..."
cp -p /etc/rc.local /etc/rc.local.sik
cat > /etc/rc.local <<-HIERDOK
echo
echo "Deleting old ssh keys..."
rm -f /etc/ssh/ssh_host_*key* 2>/dev/null
echo "... done."
echo "Generating new ssh keys..."
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N "" -t rsa -q
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N "" -t dsa -q
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N "" -t ecdsa -q
echo "... done."
mv /etc/rc.local.sik /etc/rc.local
HIERDOK
chmod +x /etc/rc.local
fi
}
drop_firstrun_script () {
patch_profile
drop_script
drop_keychanger_rclocal
}
|