Merge pull request #14 from kaqqao/master

Here-Document terminators broken during conversion #13
This commit is contained in:
helixarch 2016-03-05 03:59:20 +02:00
commit c38741176b

72
debtap
View File

@ -276,6 +276,24 @@ fi
echo -e "\n${lightgreen}***${NC} ${bold}Creation of .PKGINFO file in progress. It may take a few minutes, please wait...${normal}" echo -e "\n${lightgreen}***${NC} ${bold}Creation of .PKGINFO file in progress. It may take a few minutes, please wait...${normal}"
# Array search utility function
indexOf() {
declare -a array=("${!2}")
#echo "${array[@]}"
count=${#array[@]}
i=0
while [ "$i" -lt "$count" ]; do
if [[ "${array[$i]}" == "$1" ]]; then
echo "$i"
return 0
fi
let "i++"
done
echo "-1"
}
# The packages names translator function # The packages names translator function
packages-names-translator() { packages-names-translator() {
# First method of translating .deb packages names into Arch Linux packages names, more accurate, comparing contents of .deb packages with Arch Linux packages contents # First method of translating .deb packages names into Arch Linux packages names, more accurate, comparing contents of .deb packages with Arch Linux packages contents
@ -3517,8 +3535,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
IFS=$'\n' IFS=$'\n'
if [ -e preinst ] && [ -e postinst ]; then if [ -e preinst ] && [ -e postinst ]; then
echo "pre_install() {" > tempfile echo "pre_install() {" > tempfile
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' preinst | while read -r line; do grep -iv '#!\|automatically\|added\|generated' preinst | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
echo "}" >> tempfile echo "}" >> tempfile
echo -e "\npost_install() {" >> tempfile echo -e "\npost_install() {" >> tempfile
@ -3527,8 +3552,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then
echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile
fi fi
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' postinst | while read -r line; do grep -iv '#!\|automatically\|added\|generated' postinst | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then
echo ' update-desktop-database -q' >> tempfile echo ' update-desktop-database -q' >> tempfile
@ -3542,8 +3574,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
echo "}" >> tempfile echo "}" >> tempfile
elif [ -e preinst ] && [ ! -e postinst ]; then elif [ -e preinst ] && [ ! -e postinst ]; then
echo "pre_install() {" > tempfile echo "pre_install() {" > tempfile
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' preinst | while read -r line; do grep -iv '#!\|automatically\|added\|generated' preinst | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
echo "}" >> tempfile echo "}" >> tempfile
echo -e "\npre_upgrade() {" >> tempfile echo -e "\npre_upgrade() {" >> tempfile
@ -3556,8 +3595,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then
echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile
fi fi
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' postinst | while read -r line; do grep -iv '#!\|automatically\|added\|generated' postinst | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then
echo ' update-desktop-database -q' >> tempfile echo ' update-desktop-database -q' >> tempfile
@ -3570,8 +3616,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
if [ -e prerm ]; then if [ -e prerm ]; then
echo -e "\npre_remove() {" >> tempfile echo -e "\npre_remove() {" >> tempfile
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' prerm | while read -r line; do grep -iv '#!\|automatically\|added\|generated' prerm | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
echo "}" >> tempfile echo "}" >> tempfile
fi fi
@ -3583,8 +3636,15 @@ if [ -e preinst ] || [ -e postinst ] || [ -e prerm ] || [ -e postrm ]; then
elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then elif [ $(grep '^depend' .PKGINFO | grep -q gtk; echo $?) -eq 0 ]; then
echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile echo ' gtk-update-icon-cache -q -t -f usr/share/icons/hicolor' >> tempfile
fi fi
hereDocTerminators=()
grep -iv '#!\|automatically\|added\|generated' postrm | while read -r line; do grep -iv '#!\|automatically\|added\|generated' postrm | while read -r line; do
echo " $line" | sed s'/ / /g' >> tempfile if [[ $line == *"<<"* ]]
then
hereDocTerminators+=("${line#*<<}")
fi
index=$(indexOf $line hereDocTerminators[@])
[ "$index" -gt "-1" ] && space='' || space=' '
echo "$space$line" | sed s'/ / /g' >> tempfile
done done
if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then if [ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) -eq 0 ]; then
echo ' update-desktop-database -q' >> tempfile echo ' update-desktop-database -q' >> tempfile