dev/toolbox/diff.sh
2023-08-30 17:17:17 +03:00

74 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
RED="\e[0;31m"
GRN="\e[0;32m"
BLU="\e[0;34m"
WHT="\e[0;97m"
BRED="\e[1;31m"
BGRN="\e[1;32m"
BBLU="\e[1;34m"
BWHT="\e[1;97m"
END="\e[00m"
echo
echo -e " 📦 ${BGRN}Contrib modules${END}"
echo
cd $1/modules/ && ls -d */ > /tmp/d1
cd ../../
cd $2/modules/ && ls -d */ > /tmp/d2
cd ../../
diff /tmp/d1 /tmp/d2 -y --color=always
echo
echo -e " 📦 ${BGRN}Custom modules${END}"
echo
cd $1/modules/custom && ls -d */ > /tmp/d1
cd ../../../
cd $2/modules/custom && ls -d */ > /tmp/d2
cd ../../../
diff /tmp/d1 /tmp/d2 -y --color=always
echo
echo -e " 📦 ${BGRN}Libraries${END}"
echo
cd $1/libraries && ls -1 > /tmp/l1
cd ../../
cd $2/libraries && ls -1 > /tmp/l2
cd ../../
diff /tmp/l1 /tmp/l2 -y --color=always
#diff -qr $1/modules/custom $2/modules/custom
#echo
#echo "Themes"
#diff -qr $1/themes/ $2/themes
#echo
#echo "Users"
#cd $1 && drush uls
#cd ..
#cd $2 && drush uls
#cd ..
#echo
#echo "Views"
echo
echo -e " 🍓 ${BGRN}Content types${END}"
echo
mysql -uroot -p1234 $1 -Nse "SELECT name from $1.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq > /tmp/t1
mysql -uroot -p1234 $2 -Nse "SELECT name from $2.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq > /tmp/t2
diff /tmp/t1 /tmp/t2 -y --color=always
echo
echo -e " ☢️ ${BGRN}Core version${END}"
echo
cd $1 && drush st 2> /dev/null | grep "Drupal version" > /tmp/st1 2> /dev/null
cd ..
cd $2 && drush st 2> /dev/null | grep "Drupal version" > /tmp/st2 2> /dev/null
cd ..
diff /tmp/st1 /tmp/st2 -y --color=always
echo