|
|
|
#!/bin/sh
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
|
#
|
|
|
|
# Filename: package/.../vcd/vcd.postinstall
|
|
|
|
# Copyright (C) 2006 The OpenSDE Project
|
|
|
|
#
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
|
|
# GNU General Public License can be found in the file COPYING.
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
VXDB=D_localstatedir/vcd/vxdb
|
|
|
|
if [ ! -f "$VXDB" ]; then
|
|
|
|
echo "Creating vcd's database ..."
|
|
|
|
cat D_datadir/vcd/vxdb.sql | sqlite3 "$VXDB"
|
|
|
|
chmod 600 "$VXDB"
|
|
|
|
|
|
|
|
if [ -n "`type -p apg`" ]; then
|
|
|
|
echo "Creating initial password for vshelper ..."
|
|
|
|
password="$( apg -a 0 -M nlc -n 1 -E "'\"," )"
|
|
|
|
|
|
|
|
vxpasswd "$VXDB" vshelper "$password"
|
|
|
|
|
|
|
|
sed -i -e "s,^\(pass\)[ \t]*=.*,\1 = $password," \
|
|
|
|
-e "s,^\(user\)[ \t]*=.*,\1 = vshelper," \
|
|
|
|
D_sysconfdir/vshelper.conf
|
|
|
|
echo "Done."
|
|
|
|
else
|
|
|
|
echo "Warning: it was not possible to generate a default password"
|
|
|
|
echo " for vshelper"
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! grep -q vshelper /etc/sysctl.conf; then
|
|
|
|
echo "Activating vshelper ..."
|
|
|
|
cat <<-EOT >> /etc/sysctl.conf
|
|
|
|
|
|
|
|
# VServer helper
|
|
|
|
kernel.vshelper = D_sbindir/vshelper
|
|
|
|
EOT
|
|
|
|
sysctl -p
|
|
|
|
echo "Done."
|
|
|
|
fi
|