• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Windows10のWSL ubuntuにWORDPRESSが動くLAMP環境をセットアップします


Commit MetaInfo

Revision5 (tree)
Time2017-11-03 20:56:31
Authorearlgreyx

Log Message

エラー処理の追加

Change Summary

Incremental Difference

--- wsl-install.sh (revision 4)
+++ wsl-install.sh (revision 5)
@@ -12,23 +12,30 @@
1212 phpuploadmax=100M
1313 phpmemory=-1
1414 phptimezone=Asia\\/Tokyo
15+packages='apache2 apache2-doc mysql-server mysql-client php php-mbstring php-mysql php-sqlite3 php-gd php-mcrypt libapache2-mod-php'
1516
1617 echo 'What is your username? (not root) : '
1718 read cuser
18-if [ -z "$cuser" -o -z `grep ^${cuser} /etc/passwd` ] ; then
19- echo '[ERROR] Please input valid username.'
20- exit 1
19+if [ ! -z "${cuser}" ] ; then
20+ isvalid=`grep ^${cuser} /etc/passwd`
21+ if [ -z "${isvalid}" -o "${cuser}" = "root" ] ; then
22+ echo '[ERROR] Please input valid username.'
23+ exit 1
24+ fi
25+else
26+ echo '[ERROR] Please input username.'
27+ exit 1
2128 fi
2229
2330 echo 'Input windows directory to access by apache (ex. /mnt/c/working ): '
2431 read wdir
25-if [ ! -d $wdir ] ; then
32+if [ -z "${wdir}" -o ! -d $wdir ] ; then
2633 echo '[ERROR] Please input exisiting directory.'
2734 exit 1
2835 fi
2936 echo 'What is name associated this directory? [/working] :'
3037 read vdir
31-if [ -z "$vdir" ] ; then
38+if [ -z "${vdir}" ] ; then
3239 vdir=/working
3340 fi
3441
@@ -37,8 +44,7 @@
3744 apt update
3845 apt -y upgrade
3946
40-apt -y install apache2 apache2-doc mysql-server mysql-client
41-apt -y install php php-mbstring php-mysql php-sqlite3 php-gd php-mcrypt libapache2-mod-php
47+apt -y install $packages
4248
4349
4450 echo setting apache2 ...
@@ -110,3 +116,6 @@
110116
111117
112118 echo 'Setup apache,mysql is over.'
119+
120+exit 0
121+