source: branches/version-2_5/eccube_install.sh @ 18366

Revision 18366, 5.7 KB checked in by nanasess, 12 years ago (diff)
  • 使い方の説明を修正
  • 開発コミュニティの関連スレッド追加
  • Property svn:keywords set to Id Revision Date
Line 
1#!/bin/sh
2
3######################################################################
4#
5# EC-CUBE の再インストールを行う shell スクリプト
6#
7# ※ PostgreSQL 専用
8#
9# 1. 既存の EC-CUBE サイトを移動(PREFIX.YYYYMMDD)
10# 2. SVNリポジトリより checkout(tags/EC_CUBE_VERSION)
11# 3. パーミッション変更
12# 4. html/install/sql 配下の SQL を実行
13# 5. 管理者権限をアップデート
14# 6. data/install.php を生成
15#
16# 使い方
17#
18# # ./ec_cube_install.sh /install/path/to/eccube eccube-2.4.1
19#
20# この場合の DocumentRoot は, /install/path/to/eccube/html になります.
21#
22# 開発コミュニティの関連スレッド
23# http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=4918&forum=14&post_id=23090#forumpost23090
24#
25#######################################################################
26
27PREFIX=${PREFIX:-"$1"}
28EC_CUBE_VERSION=${EC_CUBE_VERSION:-"$2"}
29
30ADMIN_MAIL=${ADMIN_MAIL:-"shop@ec-cube.net"}
31SHOP_NAME=${SHOP_NAME:-"ロックオンのふとんやさん"}
32INSTALL_PHP="data/install.php"
33SITE_URL=${SITE_URL:-"http://demo2.ec-cube.net/"}
34SSL_URL=${SSL_URL:-"http://demo2.ec-cube.net/"}
35DOMAIN_NAME=${DOMAIN_NAME:-""}
36
37TODAY=`date "+%Y%m%d"`
38
39SVN=svn
40SVN_USER=guest
41SVN_PASSWD=lh1jNhUn
42
43REPOSITORY="https://svn.ec-cube.net/open/tags/"
44
45PGUSER=postgres
46DROPDB=dropdb
47CREATEDB=createdb
48PSQL=psql
49
50DBSERVER="127.0.0.1"
51DBNAME=demo2_db
52DBUSER=demo2_db_user
53DBPASS=password
54DBPORT=5432
55
56OPTIONAL_SQL_FILE=optional.sql
57
58
59echo "PREFIX=${PREFIX}"
60echo "EC_CUBE_VERSION=${EC_CUBE_VERSION}"
61
62if [ -d ${PREFIX} ]
63then
64    echo "backup old version..."
65    mv ${PREFIX} "${PREFIX}.${TODAY}"
66fi
67
68if [ -f ${OPTIONAL_SQL_FILE} ]
69then
70    echo "remove optional SQL"
71    rm ${OPTIONAL_SQL_FILE}
72fi
73
74echo "checkout sources from svn.ec-cube.net..."
75${SVN} checkout --username ${SVN_USER} --password ${SVN_PASSWD} \
76    "${REPOSITORY}/${EC_CUBE_VERSION}" ${PREFIX}
77
78echo "update permissions..."
79chmod -R 777 "${PREFIX}/data/cache"
80chmod -R 777 "${PREFIX}/data/class"
81chmod -R 777 "${PREFIX}/data/Smarty"
82chmod -R 777 "${PREFIX}/data/logs"
83chmod -R 777 "${PREFIX}/data/downloads"
84chmod -R 777 "${PREFIX}/html/install/temp"
85chmod -R 777 "${PREFIX}/html/user_data"
86chmod -R 777 "${PREFIX}/html/cp"
87chmod -R 777 "${PREFIX}/html/upload"
88
89#echo "dropdb..."
90#su ${PGUSER} -c "${DROPDB} ${DBNAME}"
91
92#echo "createdb..."
93#su ${PGUSER} -c "${CREATEDB} -U ${DBUSER} ${DBNAME}"
94
95SQL_DIR="${PREFIX}/html/install/sql"
96
97echo "drop view..."
98su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/drop_view.sql ${DBNAME}"
99
100echo "drop tables..."
101su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/drop_table.sql ${DBNAME}"
102su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_session;' ${DBNAME}"
103su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_module;' ${DBNAME}"
104su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_campaign_order;' ${DBNAME}"
105su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_mobile_kara_mail;' ${DBNAME}"
106su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_mobile_ext_session_id;' ${DBNAME}"
107su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_site_control;' ${DBNAME}"
108su ${PGUSER} -c "${PSQL} -U ${DBUSER} -c 'DROP TABLE dtb_trackback;' ${DBNAME}"
109
110echo "create table..."
111su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/create_table_pgsql.sql ${DBNAME}"
112
113echo "create_view..."
114su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/create_view.sql ${DBNAME}"
115
116echo "adding table comment..."
117su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/table_comment.sql ${DBNAME}"
118
119echo "adding tables..."
120su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_campaign_order_pgsql.sql ${DBNAME}"
121su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_mobile_ext_session_id_pgsql.sql ${DBNAME}"
122su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_mobile_kara_mail_pgsql.sql ${DBNAME}"
123su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_module_pgsql.sql ${DBNAME}"
124su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_session_pgsql.sql ${DBNAME}"
125su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_site_control_pgsql.sql ${DBNAME}"
126su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_trackback_pgsql.sql ${DBNAME}"
127
128echo "insert data..."
129su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/insert_data.sql ${DBNAME}"
130
131echo "create optional SQL..."
132echo "INSERT INTO dtb_member (member_id, login_id, password, authority, creator_id) VALUES ('1', 'admin', '2c19f4a742398150cecc80b3e76b673a35b8c19c', '0', '0');" >> ${OPTIONAL_SQL_FILE}
133echo "INSERT INTO dtb_baseinfo (shop_name, email01, email02, email03, email04, email05, top_tpl, product_tpl, detail_tpl, mypage_tpl) VALUES ('${SHOP_NAME}', '${ADMIN_MAIL}', '${ADMIN_MAIL}', '${ADMIN_MAIL}', '${ADMIN_MAIL}', '${ADMIN_MAIL}', 'default1', 'default1', 'default1', 'default1');" >> ${OPTIONAL_SQL_FILE}
134echo "execute optional SQL..."
135su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${OPTIONAL_SQL_FILE} ${DBNAME}"
136
137echo "copy images..."
138cp -rv "${PREFIX}/html/install/save_image" "${PREFIX}/html/upload/"
139
140echo "creating ${INSTALL_PHP}..."
141cat > "${PREFIX}/${INSTALL_PHP}" <<EOF
142<?php
143define ('ECCUBE_INSTALL', 'ON');
144define ('HTML_PATH', '${PREFIX}/html/');
145define ('SITE_URL', '${SITE_URL}');
146define ('SSL_URL', '${SSL_URL}');
147define ('URL_DIR', '/');
148define ('DOMAIN_NAME', '${DOMAIN_NAME}');
149define ('DB_TYPE', 'pgsql');
150define ('DB_USER', '${DBUSER}');
151define ('DB_PASSWORD', '${DBPASS}');
152define ('DB_SERVER', '${DBSERVER}');
153define ('DB_NAME', '${DBNAME}');
154define ('DB_PORT', '${DBPORT}');
155define ('DATA_PATH', '${PREFIX}/data/');
156define ('MOBILE_HTML_PATH', HTML_PATH . 'mobile/');
157define ('MOBILE_SITE_URL', SITE_URL . 'mobile/');
158define ('MOBILE_SSL_URL', SSL_URL . 'mobile/');
159define ('MOBILE_URL_DIR', URL_DIR . 'mobile/');
160?>
161EOF
162
163echo "Finished Successful!"
Note: See TracBrowser for help on using the repository browser.