source: branches/version-2_12-dev/eccube_install.sh @ 20319

Revision 20319, 5.6 KB checked in by AMUAMU, 10 years ago (diff)

#793 (非推奨機能の削除) #476 の改修に伴う不要テーブル関係情報の削除

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
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 tables..."
117su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_campaign_order_pgsql.sql ${DBNAME}"
118su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_mobile_ext_session_id_pgsql.sql ${DBNAME}"
119su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_mobile_kara_mail_pgsql.sql ${DBNAME}"
120su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_module_pgsql.sql ${DBNAME}"
121su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_session_pgsql.sql ${DBNAME}"
122su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_site_control_pgsql.sql ${DBNAME}"
123su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/add/dtb_trackback_pgsql.sql ${DBNAME}"
124
125echo "insert data..."
126su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${SQL_DIR}/insert_data.sql ${DBNAME}"
127
128echo "create optional SQL..."
129echo "INSERT INTO dtb_member (member_id, login_id, password, authority, creator_id) VALUES ('1', 'admin', '2c19f4a742398150cecc80b3e76b673a35b8c19c', '0', '0');" >> ${OPTIONAL_SQL_FILE}
130echo "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}
131echo "execute optional SQL..."
132su ${PGUSER} -c "${PSQL} -U ${DBUSER} -f ${OPTIONAL_SQL_FILE} ${DBNAME}"
133
134echo "copy images..."
135cp -rv "${PREFIX}/html/install/save_image" "${PREFIX}/html/upload/"
136
137echo "creating ${INSTALL_PHP}..."
138cat > "${PREFIX}/${INSTALL_PHP}" <<EOF
139<?php
140define ('ECCUBE_INSTALL', 'ON');
141define ('HTML_PATH', '${PREFIX}/html/');
142define ('SITE_URL', '${SITE_URL}');
143define ('SSL_URL', '${SSL_URL}');
144define ('URL_DIR', '/');
145define ('DOMAIN_NAME', '${DOMAIN_NAME}');
146define ('DB_TYPE', 'pgsql');
147define ('DB_USER', '${DBUSER}');
148define ('DB_PASSWORD', '${DBPASS}');
149define ('DB_SERVER', '${DBSERVER}');
150define ('DB_NAME', '${DBNAME}');
151define ('DB_PORT', '${DBPORT}');
152define ('DATA_PATH', '${PREFIX}/data/');
153define ('MOBILE_HTML_PATH', HTML_PATH . 'mobile/');
154define ('MOBILE_SITE_URL', SITE_URL . 'mobile/');
155define ('MOBILE_SSL_URL', SSL_URL . 'mobile/');
156define ('MOBILE_URL_DIR', URL_DIR . 'mobile/');
157?>
158EOF
159
160echo "Finished Successful!"
Note: See TracBrowser for help on using the repository browser.