Commit d29fbab6 authored by Jondy Zhao's avatar Jondy Zhao

Configure cygserver and syslog-ng when initialize cygwin

parent f9cb2f01
#! /bin/bash #! /bin/bash
# #
# When cygwin is installed, then call this script by Administrator: # When cygwin is installed, then call this script by Administrator:
# #
# /bin/bash/ --login -i init-cygwin.sh # /bin/bash/ --login -i init-cygwin.sh
# #
# It used to create root account. # It will do:
#
# 1. Set uid of Adminstrator to 0, and create root account
#
# 2. Create .minttyrc and cygtty.bat, which used to start comand console
#
# 3. Configure cygserver
#
# 4. Configure syslog-ng
# #
if [[ ! "$(whoami)" == "Administrator" ]] ; then if [[ ! "$(whoami)" == "Administrator" ]] ; then
...@@ -18,10 +25,11 @@ else ...@@ -18,10 +25,11 @@ else
cp /etc/passwd /etc/passwd.orig cp /etc/passwd /etc/passwd.orig
fi fi
sed -i -e "s/Administrator:unused:500:/Administrator:unused:0:/g" /etc/passwd
grep -q "^root:" /etc/passwd grep -q "^root:" /etc/passwd
if (( $? != 0 )) ; then if (( $? != 0 )) ; then
myaccount=$(grep "^Administrator:" /etc/passwd | \ myaccount=$(grep "^Administrator:" /etc/passwd | \
sed -e "s/500:/0:/" -e "s/Administrator:/root:/g") sed -e "s/Administrator:/root:/g")
if [[ "${myaccount:0:4}" == root ]] ; then if [[ "${myaccount:0:4}" == root ]] ; then
echo $myaccount >> /etc/passwd echo $myaccount >> /etc/passwd
else else
...@@ -51,5 +59,11 @@ EOF ...@@ -51,5 +59,11 @@ EOF
chmod +x /cygtty.bat chmod +x /cygtty.bat
fi fi
# Configure cygserver
/usr/bin/cygserver-config --yes
# Configure syslog-ng
/usr/bin/syslog-ng-config --yes
exit 0 exit 0
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