Skip to content

Instantly share code, notes, and snippets.

@ilyautkin
Last active February 17, 2025 13:07
Show Gist options
  • Save ilyautkin/3dd5c9a0327211a46a888ee3f0428ecc to your computer and use it in GitHub Desktop.
Save ilyautkin/3dd5c9a0327211a46a888ee3f0428ecc to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Select theme version:";
echo "1. Basic";
echo "2. Advanced";
echo "3. Webshop";
while [ "$version" = "" ]
do
read -p "Enter selected number: " version;
done;
echo "Select manager theme:";
echo "1. Heibel";
echo "2. Default";
while [ "$theme" = "" ]
do
read -p "Enter selected number: " theme;
done;
sitename_default=`whoami`
read -p "Enter website name ($sitename_default.nl): " sitename;
if [ ! $sitename ]; then
sitename="$sitename_default.nl";
fi;
echo "Enter database credentials"
read -p "Host (127.0.0.1): " dbhost;
if [ ! $dbhost ]; then
dbhost="127.0.0.1";
fi;
dbname_default=`whoami`
read -p "Database ($dbname_default): " dbname;
if [ ! $dbname ]; then
dbname=$dbname_default;
dbuser=$dbname_default;
else
read -p "Username ($dbname): " dbuser;
if [ ! $dbuser ]; then
dbuser=$dbname;
fi;
fi;
while [ "$dbpass" = "" ]
do
read -p "Password: " dbpass;
done;
umask 0022;
php8.1 /usr/bin/composer.phar create-project modx/revolution=3.0.6-pl www;
cd ~/www;
echo "<?php
return \$data = [
'server' => '$dbhost',
'db_name' => '$dbname',
'db_user' => '$dbuser',
'db_pass' => '$dbpass',
];
" > config.php;
mkdir theme;
echo '{
"name": "heibel/'$sitename'",
"version": "v1.0.0",
"type": "project",
"license": "MIT",
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"vendor-dir": "."
},
"require": {
"sterc/usermanagement": "^1.0.0",
"heibel/modx3-circle": "3.*.*"
},
"repositories": [
{ "type": "vcs", "url": "https://bitbucket.org/sterc/usermanagement.git" },
{ "type": "vcs", "url": "https://bitbucket.org/heibelsites/modx3-circle.git" }
]
}
' > theme/composer.json;
cd theme;
php8.1 /usr/bin/composer.phar config --global bitbucket-oauth.bitbucket.org GRz9XYqGLguE4zhpXE N6gQYmWGbX68ZsYgMRfE39RrhM3QLP5C
php8.1 /usr/bin/composer.phar update;
echo "<?php" > config.php;
if [ "$version" -eq "1" ]; then
echo "\$theme_version = 'basic';" >> config.php;
fi;
if [ "$version" -eq "2" ]; then
echo "\$theme_version = 'advanced';" >> config.php;
fi;
if [ "$version" -eq "3" ]; then
echo "\$theme_version = 'webshop';" >> config.php;
fi;
if [ "$theme" -eq "1" ]; then
echo "\$manager_theme = 'heibel';" >> config.php;
fi;
if [ "$theme" -eq "2" ]; then
echo "\$manager_theme = 'default';" >> config.php;
fi;
php8.1 ./heibel/modx3-circle/installer/installer.php install;
php8.1 ./heibel/modx3-circle/installer/installer.php theme;
rm -f ~/theme-installer*;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment