Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iMojtaba/d6a712d4c0e261b732fcff24114525b7 to your computer and use it in GitHub Desktop.
Save iMojtaba/d6a712d4c0e261b732fcff24114525b7 to your computer and use it in GitHub Desktop.
این اسکریپت برای دانلود و نصب آخرین نسخه از وردپرس فارسی است. کافیست آن را به مسیر /usr/bin منتقل کنید.
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
read -s dbpass
echo "run install? (y/n)"
read -e run
if [ "$run" == n ] ; then
exit
else
echo "============================================"
echo "A robot is now installing WordPress for you."
echo "============================================"
mysql -u$dbuser -p$dbpass -e "create database $dbname"
#download wordpress
wget https://fa.wordpress.org/latest-fa_IR.zip
#unzip wordpress
unzip latest-fa_IR.zip
#change dir to wordpress
cd wordpress
#copy file to parent dir
cp -rf . ..
#move back to parent dir
cd ..
#remove files from wordpress folder
rm -R wordpress
#create wp config
cp wp-config-sample.php wp-config.php
#set database details with perl find and replace
perl -pi -e "s/database_name_here/$dbname/g" wp-config.php
perl -pi -e "s/username_here/$dbuser/g" wp-config.php
perl -pi -e "s/password_here/$dbpass/g" wp-config.php
#set WP salts
perl -i -pe'
BEGIN {
@chars = ("a" .. "z", "A" .. "Z", 0 .. 9);
push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|";
sub salt { join "", map $chars[ rand @chars ], 1 .. 64 }
}
s/put your unique phrase here/salt()/ge
' wp-config.php
#create uploads folder and set permissions
mkdir wp-content/uploads
chmod 775 wp-content/uploads
echo "Cleaning..."
#remove zip file
rm latest-fa_IR.zip
echo "========================="
echo "Installation is complete."
echo "========================="
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment