File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,17 @@ if [ "$action" == 'create' ]
123123 echo -e $" Host added to /etc/hosts file \n"
124124 fi
125125
126+ # ## Add domain in /mnt/c/Windows/System32/drivers/etc/hosts (Windows Subsytem for Linux)
127+ if [ -e /mnt/c/Windows/System32/drivers/etc/hosts ]
128+ then
129+ if ! echo -e " \r127.0.0.1 $domain " >> /mnt/c/Windows/System32/drivers/etc/hosts
130+ then
131+ echo $" ERROR: Not able to write in /mnt/c/Windows/System32/drivers/etc/hosts (Hint: Try running Bash as administrator)"
132+ else
133+ echo -e $" Host added to /mnt/c/Windows/System32/drivers/etc/hosts file \n"
134+ fi
135+ fi
136+
126137 if [ " $owner " == " " ]; then
127138 chown -R $( whoami) :www-data $userDir$rootDir
128139 else
@@ -148,6 +159,13 @@ if [ "$action" == 'create' ]
148159 newhost=${domain// ./ \\ .}
149160 sed -i " /$newhost /d" /etc/hosts
150161
162+ # ## Delete domain in /mnt/c/Windows/System32/drivers/etc/hosts (Windows Subsytem for Linux)
163+ if [ -e /mnt/c/Windows/System32/drivers/etc/hosts ]
164+ then
165+ newhost=${domain// ./ \\ .}
166+ sed -i " /$newhost /d" /mnt/c/Windows/System32/drivers/etc/hosts
167+ fi
168+
151169 # ## disable website
152170 rm $sitesEnable$domain
153171
Original file line number Diff line number Diff line change @@ -103,6 +103,17 @@ if [ "$action" == 'create' ]
103103 echo -e $" Host added to /etc/hosts file \n"
104104 fi
105105
106+ # ## Add domain in /mnt/c/Windows/System32/drivers/etc/hosts (Windows Subsytem for Linux)
107+ if [ -e /mnt/c/Windows/System32/drivers/etc/hosts ]
108+ then
109+ if ! echo -e " \r127.0.0.1 $domain " >> /mnt/c/Windows/System32/drivers/etc/hosts
110+ then
111+ echo $" ERROR: Not able to write in /mnt/c/Windows/System32/drivers/etc/hosts (Hint: Try running Bash as administrator)"
112+ else
113+ echo -e $" Host added to /mnt/c/Windows/System32/drivers/etc/hosts file \n"
114+ fi
115+ fi
116+
106117 if [ " $owner " == " " ]; then
107118 iam=$( whoami)
108119 if [ " $iam " == " root" ]; then
@@ -133,6 +144,13 @@ if [ "$action" == 'create' ]
133144 newhost=${domain// ./ \\ .}
134145 sed -i " /$newhost /d" /etc/hosts
135146
147+ # ## Delete domain in /mnt/c/Windows/System32/drivers/etc/hosts (Windows Subsytem for Linux)
148+ if [ -e /mnt/c/Windows/System32/drivers/etc/hosts ]
149+ then
150+ newhost=${domain// ./ \\ .}
151+ sed -i " /$newhost /d" /mnt/c/Windows/System32/drivers/etc/hosts
152+ fi
153+
136154 # ## disable website
137155 a2dissite $domain
138156
You can’t perform that action at this time.
0 commit comments