Compare commits

...

7 Commits
3.4 ... master

Author SHA1 Message Date
helixarch
0c4f92b12e
Merge pull request #93 from SnivySquid65/master
Added choice in updating when given the "run debtap -u" prompt.
2025-03-06 00:12:23 +02:00
SnivySquid65
795ad62414 patch for teh pull request 2025-03-05 22:04:21 +00:00
helixarch
99991fa9c9
Add files via upload 2022-04-25 10:45:43 +03:00
helixarch
4a94689739
Add files via upload 2022-04-25 07:33:55 +03:00
helixarch
a72e9f1335
Merge pull request #73 from pkasemir/add-zstd-support
Add tar zstd support
2022-04-21 21:30:39 +03:00
Paul Kasemir
7bb6814d35 Add tar zstd support 2022-04-01 17:02:53 -06:00
helixarch
02d3b9f8fd
Update debtap 2021-04-09 10:35:19 +03:00

169
debtap
View File

@ -1,6 +1,6 @@
#!/usr/bin/bash
# Copyright 2014-2020 George Savvidis
# Copyright 2014-2022 George Savvidis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Version=3.4
Version=3.5.1
# Defining colors and bold letters
lightgreen='\e[1;32m'
@ -82,24 +82,24 @@ elif [[ $update == set ]]; then
elif [[ "$(uname -m)" == "aarch64" ]]; then
_arch=arm64
fi
ubuntu_latest_stable_version=`curl -s https://packages.ubuntu.com | grep option | gawk -F '=' '{print $2}' | gawk '{print $1}' | grep -v option | tac | sed -n 3'{p;q;}' | sed s'/\("\|-updated\|-backports\)//g'`
curl -C - -f http://ftp.debian.org/debian/dists/sid/main/Contents-$_arch.gz > /var/cache/debtap/debian-main-packages-files.gz
ubuntu_latest_stable_version=`curl -k -s https://packages.ubuntu.com | grep option | gawk -F '=' '{print $2}' | gawk '{print $1}' | grep -v option | tac | sed -n 3'{p;q;}' | sed s'/\("\|-updated\|-backports\)//g'`
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/main/Contents-$_arch.gz > /var/cache/debtap/debian-main-packages-files.gz
gzip -df /var/cache/debtap/debian-main-packages-files.gz
curl -C - -f http://ftp.debian.org/debian/dists/sid/non-free/Contents-$_arch.gz > /var/cache/debtap/debian-non-free-packages-files.gz
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/non-free/Contents-$_arch.gz > /var/cache/debtap/debian-non-free-packages-files.gz
gzip -df /var/cache/debtap/debian-non-free-packages-files.gz
curl -C - -f http://ftp.debian.org/debian/dists/sid/contrib/Contents-$_arch.gz > /var/cache/debtap/debian-contrib-packages-files.gz
curl -k -C - -f http://ftp.debian.org/debian/dists/sid/contrib/Contents-$_arch.gz > /var/cache/debtap/debian-contrib-packages-files.gz
gzip -df /var/cache/debtap/debian-contrib-packages-files.gz
if [[ $_arch == amd64 ]]; then
curl -C - -f http://archive.ubuntu.com/ubuntu/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
curl -k -C - -f http://archive.ubuntu.com/ubuntu/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
else
curl -C - -f http://ports.ubuntu.com/ubuntu-ports/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
curl -k -C - -f http://ports.ubuntu.com/ubuntu-ports/dists/$ubuntu_latest_stable_version/Contents-$_arch.gz > /var/cache/debtap/ubuntu-packages-files.gz
fi
gzip -df /var/cache/debtap/ubuntu-packages-files.gz
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest virtual packages list...${normal}"
curl -L https://github.com/helixarch/virtual-packages-list-generator/archive/master.tar.gz > /var/cache/debtap/master.tar.gz
curl -k -L https://github.com/helixarch/virtual-packages-list-generator/archive/master.tar.gz > /var/cache/debtap/master.tar.gz
tar xfz /var/cache/debtap/master.tar.gz -C /var/cache/debtap
mv /var/cache/debtap/virtual-packages-list-generator-master/virtual-packages /var/cache/debtap
rm -rf /var/cache/debtap/master.tar.gz /var/cache/debtap/virtual-packages-list-generator-master
@ -107,7 +107,7 @@ elif [[ $update == set ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest AUR packages list...${normal}"
curl -C - -f https://aur.archlinux.org/packages.gz > /var/cache/debtap/aur-packages.gz
curl -k -C - -f https://aur.archlinux.org/packages.gz > /var/cache/debtap/aur-packages.gz
gzip -df /var/cache/debtap/aur-packages.gz
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
@ -126,21 +126,54 @@ elif [[ "${@: -1}" == "debtap" ]] || [[ "${@: -1}" =~ /debtap$ ]] || [[ "${@: -1
echo -e "${red}Error: You haven't specified a deb package${NC}\nSyntax: debtap [options] package_filename\n\nOptions:\n\n -h --help Print this help message\n -u --update Update debtap database\n -q --quiet Bypass all questions, except for editing metadata file(s)\n -Q --Quiet Bypass all questions (not recommended)\n -s --pseudo Create a pseudo-64-bit package from a 32-bit .deb package\n -w --wipeout Wipeout versions from all dependencies, conflicts etc.\n -p --pkgbuild Additionally generate a PKGBUILD file\n -P --Pkgbuild Generate a PKGBUILD file only\n -v --version Print version"; exit 1
elif [[ "${@: -1}" =~ ^(-)+(.)*$ ]] || [[ $(ls "${@: -1}" &> /dev/null; echo $?) != 0 ]]; then
echo -e "${red}Error: No such file or directory or invalid option${NC}"; exit 1
elif [[ $(file -b "${@: -1}" | grep -q "Debian binary package"; echo $?) != 0 ]]; then
elif [[ $(file -S -b "${@: -1}" | grep -q "Debian binary package"; echo $?) != 0 ]]; then
echo -e "${red}Error: You haven't specified a valid deb package${NC}"; exit 1
fi
if [[ ! $(ls /var/cache/pkgfile/*.files 2> /dev/null) ]] || [[ ! $(ls /var/cache/debtap/*-packages-files 2> /dev/null) ]] || [[ ! -e /var/cache/debtap/base-packages ]] || [[ ! -e /var/cache/debtap/aur-packages ]] || [[ ! -e /var/cache/debtap/virtual-packages ]]; then
# This should fix it. Patch by SnivySquid65!
if [[ $pseudo != set ]]; then
echo -e "${red}Error: You must run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
while true; do
read -p "Updates may be available that are not installed! Proceed anyway? (If you've already ran 'debtap -u' recently, you can ignore this and continue.) (y/n) " yn
case $yn in
[yY] ) echo "Then let's continue!";
break;;
[nN] ) echo "Aborted!!";
exit;;
* ) echo "Invalid input.";;
esac
done
else
echo -e "${red}Error: You must enable a multilib repository, synchronize pacman database and then run at least once \"debtap -u\" with root privileges (preferably recently), before running this script${NC}"; exit 1
echo "You made it past the update request bug! Yay!"
fi
fi
tar_extract_cmd() {
local file="${@: -1}"
local flags
case "$file" in
*.tar) flags="" ;;
*.tar.gz) flags="z" ;;
*.tar.xz) flags="J" ;;
*.tar.bz2) flags="j" ;;
*.tar.lzma) flags="J" ;;
*.tar.zst) flags="I unzstd"
if ! which unzstd >/dev/null; then
echo -e "${red}Error: extracting $file requires unzstd${NC}" >&2
return 1
fi
;;
*)
echo -e "${red}Error: Don't know how to extract '$file'${NC}" >&2
return 1
;;
esac
echo "tar -x$flags"
}
# Defining package with full path & defining and creating working directory
package_with_full_path="`readlink -f "${@: -1}"`"
working_directory="`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
working_directory="`pwd`/`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
rm -rf "$working_directory" 2> /dev/null
mkdir "$working_directory" 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
@ -151,92 +184,89 @@ cd "$working_directory"
# Extracting package data and metadata in working directory (also checking package architecture, if you are running the pseudo option)
echo -e "${lightgreen}==>${NC} ${bold}Extracting package data...${normal}"
control_tar_check=`ar t "$package_with_full_path" | grep control`
if [[ $control_tar_check == control.tar.gz ]]; then
ar p "$package_with_full_path" control.tar.gz | tar xz
elif [[ $control_tar_check == control.tar.xz ]]; then
ar p "$package_with_full_path" control.tar.xz | tar xJ
fi
if [[ $pseudo == set ]] && [[ $(grep ^Architecture: control | grep -q i386; echo $?) != 0 ]]; then
echo -e "${red}Error: Invalid package architecture. Removing extracted package data and exiting...${NC}"
cd ..
control_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "control\.tar")
control_extract=$(tar_extract_cmd "$control_tar_check")
if [ $? != 0 ]; then
rm -rf "$working_directory"
exit 1
fi
rm -rf $(ls * | grep -v 'control\|preinst\|postinst\|prerm\|postrm\|conffiles')
data_tar_check=`ar t "$package_with_full_path" | grep data`
if [[ $data_tar_check == data.tar.gz ]]; then
ar p "$package_with_full_path" data.tar.gz | tar xz
elif [[ $data_tar_check == data.tar.xz ]]; then
ar p "$package_with_full_path" data.tar.xz | tar xJ
elif [[ $data_tar_check == data.tar.bz2 ]]; then
ar p "$package_with_full_path" data.tar.bz2 | tar xj
elif [[ $data_tar_check == data.tar.lzma ]]; then
ar p "$package_with_full_path" data.tar.lzma | tar xJ
elif [[ $data_tar_check == data.tar ]]; then
ar p "$package_with_full_path" data.tar | tar x
ar p "$package_with_full_path" "$control_tar_check" | $control_extract
if [[ $pseudo == set ]] && [[ $(grep ^Architecture: control | grep -q i386; echo $?) != 0 ]]; then
echo -e "${red}Error: Invalid package architecture. Removing extracted package data and exiting...${NC}"
rm -rf "$working_directory"
exit 1
fi
rm -rf $(ls * | grep -v 'control\|preinst\|postinst\|prerm\|postrm\|conffiles')
data_tar_check=$(ar t "$package_with_full_path" | grep -m 1 "data\.tar")
data_extract=$(tar_extract_cmd "$data_tar_check")
if [ $? != 0 ]; then
rm -rf "$working_directory"
exit 1
fi
ar p "$package_with_full_path" "$data_tar_check" | $data_extract
# Fixing possible differences in filesystem hierarchy of the extracted package data, so that it matches Arch Linux filesystem hierarchy
echo -e "${lightgreen}==>${NC} ${bold}Fixing possible directories structure differencies...${normal}"
if [[ $pkgbuild == set ]] || [[ $Pkgbuild == set ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*license*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
echo "install -D -m644 \"$(find ./ -iname '*license*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
if [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/COPYRIGHT\"" >> pkgbuildinstallations1
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/COPYRIGHT\"" >> pkgbuildinstallations1
else
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
echo "install -D -m644 \"$(find ./ -iname '*copyright*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
fi
if [[ $(find ./ -iname '*eula*' | wc -l) != 0 ]]; then
if [[ $(find ./ -iname '*license*' | wc -l) != 0 ]] || [[ $(find ./ -iname '*copyright*' | wc -l) != 0 ]]; then
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/EULA\"" >> pkgbuildinstallations1
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/EULA\"" >> pkgbuildinstallations1
else
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.//')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
echo "install -D -m644 \"$(find ./ -iname '*eula*' | sort | tail -1 | sed s'/^\.\///')\" \"\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE\"" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/games ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/games/* usr/bin; rm -rf usr/games' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/games\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/games\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e bin ]]; then
echo 'mkdir -p usr/bin 2> /dev/null; mv bin/* usr/bin; rm -rf bin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/bin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/bin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e sbin ]]; then
echo 'mkdir -p usr/bin 2> /dev/null; mv sbin/* usr/bin; rm -rf sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/sbin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/sbin/* usr/bin; rm -rf usr/sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/games ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/games/* usr/bin; rm -rf usr/local/games' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/games\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/games\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/bin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/bin/* usr/bin; rm -rf usr/local/bin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/bin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/bin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ -e usr/local/sbin ]]; then
echo 'mkdir usr/bin 2> /dev/null; mv usr/local/sbin/* usr/bin; rm -rf usr/local/sbin' >> pkgbuildinstallations1
if [[ -e usr/share/applications ]]; then
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\\/usr\\/local\\/sbin\\//Exec=\\/usr\\/bin\\//g' \"$line\"\ndone" >> pkgbuildinstallations1
echo -e "ls usr/share/applications/*.desktop | while read line; do\n\tsed -i s'/^Exec=\/usr\/local\/sbin\//Exec=\/usr\/bin\//g' \"\$line\"\ndone" >> pkgbuildinstallations1
fi
fi
if [[ $pseudo != set ]]; then
@ -427,7 +457,7 @@ fi
if [[ $(echo `grep -v ":\| \." control` | grep -iq "`grep -i ^Description: control | sed s'/^Description: //i' | sed s'/\.//'`"; echo $?) == 0 ]]; then
description=$(echo $(echo "`grep -v ":\| \." control`") | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g')
else
description=$(echo $(echo "`grep -i ^Description: control | sed s'/^Description: //i' | sed 's/.*/\u&/'`" | sed s'/\.//'). `grep -v ":\| \." control` | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g')
description=$(echo $(echo "`grep -i ^Description: control | sed s'/^Description: //i' | sed 's/.*/\u&/'`" | sed s'/\.//'). `grep -v ":\| \." control` | sed s'/^\s*./\U&\E/g' | sed s'/\(\. \|\! \|\? \)\s*./\U&\E/g' | sed s'/\!\./\!/g' | sed s'/\?\./\?/g')
fi
echo "pkgdesc = $description" >> .PKGINFO
@ -443,7 +473,7 @@ if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
else
source /usr/share/makepkg/util/config.sh
load_makepkg_config
echo -e "\n${lightblue}::${NC} Enter Packager name:"
echo -e "\n${lightblue}::${NC} Enter Packager name (can be left blank):"
read -e -i "${PACKAGER}" packager_name
echo "packager = $packager_name" >> .PKGINFO
fi
@ -507,7 +537,7 @@ echo "size =" $((`du -sb | tr -d " ."` - `ls -l | grep control | gawk '{print $5
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
echo "license = custom" >> .PKGINFO
else
echo -e "\n${lightblue}::${NC} Enter package license (you can enter multiple licenses comma separated):"
echo -e "\n${lightblue}::${NC} Enter package license (can be left blank, you can enter multiple licenses comma separated):"
read package_license
for i in `echo "$package_license" | sed -e s'/ /__/g' -e s'/,/ /g'`; do
license+=($i)
@ -2979,7 +3009,7 @@ if [[ -e preinst ]]; then
sed -i -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/.*install.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' preinst
sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*install.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' preinst
fi
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' preinst | while read -r line; do
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' preinst | while read -r line; do
printf '\t%s\n' "$line" >> tempfile1
done
fi
@ -3002,7 +3032,7 @@ if [[ -e postinst ]]; then
sed -i -e '/.*configure.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' postinst
sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*configure.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' postinst
fi
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternative\|--slave\|db_\|remove_source\|update_manager\|lintian' postinst | while read -r line; do
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|update-alternative\|--slave\|db_\|remove_source\|update_manager\|lintian' postinst | while read -r line; do
printf '\t%s\n' "$line" >> tempfile1
done
fi
@ -3035,7 +3065,7 @@ if [[ -e prerm ]]; then
sed -i -e '/.*remove.*)[[:blank:]]\{0,\}$/d' -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' prerm
sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1/g' -e s'/.*remove.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' prerm
fi
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' prerm | while read -r line; do
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' prerm | while read -r line; do
printf '\t%s\n' "$line" >> tempfile1
done
fi
@ -3053,12 +3083,12 @@ fi
if [[ -e postrm ]]; then
sed -i -e '/how this script works/,/debian-policy/d' -e '/how this script works/,/version>/d' -e '/dh_installdeb/,/DEBHELPER/d' postrm
if [[ $(grep -c "case in \$1\|case in \${1}\|case in \"\$1\"\|case in \"\${1}\"\|case \$1 in\|case \${1} in\|case \"\$1\" in\|case \"\${1}\" in" postrm) == $(grep -c "case " postrm) ]]; then
sed -i -e '/case in \$1/,/remove/{/remove/!d}' -e '/case in {1}/,/remove/{/remove/!d}' -e '/case in "\$1"/,/remove/{/remove/!d}' -e '/case in "{1}"/,/remove/{/remove/!d}' -e '/case \$1 in/,/remove/{/remove/!d}' -e '/case {1} in/,/remove/{/remove/!d}' -e '/case "\$1" in/,/remove/{/remove/!d}' -e '/case "{1}" in/,/remove/{/remove/!d}' -e '/case in \$1/,/purge/{/purge/!d}' -e '/case in {1}/,/purge/{/purge/!d}' -e '/case in "\$1"/,/purge/{/purge/!d}' -e '/case in "{1}"/,/purge/{/purge/!d}' -e '/case \$1 in/,/purge/{/purge/!d}' -e '/case {1} in/,/purge/{/purge/!d}' -e '/case "\$1" in/,/purge/{/purge/!d}' -e '/case "{1}" in/,/purge/{/purge/!d}' -e '/case in \$1/,/upgrade/{/upgrade/!d}' -e '/case in \${1}/,/upgrade/{/upgrade/!d}' -e '/case in "\$1"/,/upgrade/{/upgrade/!d}' -e '/case in "\${1}"/,/upgrade/{/upgrade/!d}' -e '/case \$1 in/,/upgrade/{/upgrade/!d}' -e '/case \${1} in/,/upgrade/{/upgrade/!d}' -e '/case "\$1" in/,/upgrade/{/upgrade/!d}' -e '/case "\${1}" in/,/upgrade/{/upgrade/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/upda..te-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' postrm
sed -i -e '/case in \$1/,/remove/{/remove/!d}' -e '/case in {1}/,/remove/{/remove/!d}' -e '/case in "\$1"/,/remove/{/remove/!d}' -e '/case in "{1}"/,/remove/{/remove/!d}' -e '/case \$1 in/,/remove/{/remove/!d}' -e '/case {1} in/,/remove/{/remove/!d}' -e '/case "\$1" in/,/remove/{/remove/!d}' -e '/case "{1}" in/,/remove/{/remove/!d}' -e '/case in \$1/,/purge/{/purge/!d}' -e '/case in {1}/,/purge/{/purge/!d}' -e '/case in "\$1"/,/purge/{/purge/!d}' -e '/case in "{1}"/,/purge/{/purge/!d}' -e '/case \$1 in/,/purge/{/purge/!d}' -e '/case {1} in/,/purge/{/purge/!d}' -e '/case "\$1" in/,/purge/{/purge/!d}' -e '/case "{1}" in/,/purge/{/purge/!d}' -e '/case in \$1/,/upgrade/{/upgrade/!d}' -e '/case in \${1}/,/upgrade/{/upgrade/!d}' -e '/case in "\$1"/,/upgrade/{/upgrade/!d}' -e '/case in "\${1}"/,/upgrade/{/upgrade/!d}' -e '/case \$1 in/,/upgrade/{/upgrade/!d}' -e '/case \${1} in/,/upgrade/{/upgrade/!d}' -e '/case "\$1" in/,/upgrade/{/upgrade/!d}' -e '/case "\${1}" in/,/upgrade/{/upgrade/!d}' -e '/case in \$1/,/update-alternatives/{/update-alternatives/!d}' -e '/case in {1}/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "\$1"/,/update-alternatives/{/update-alternatives/!d}' -e '/case in "{1}"/,/update-alternatives/{/update-alternatives/!d}' -e '/case \$1 in/,/update-alternatives/{/update-alternatives/!d}' -e '/case {1} in/,/update-alternatives/{/updaste-alternatives/!d}' -e '/case "\$1" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case "{1}" in/,/update-alternatives/{/update-alternatives/!d}' -e '/case in \$1/,/db_/{/db_/!d}' -e '/case in {1}/,/db_/{/db_/!d}' -e '/case in "\$1"/,/db_/{/db_/!d}' -e '/case in "{1}"/,/db_/{/db_/!d}' -e '/case \$1 in/,/db_/{/db_/!d}' -e '/case {1} in/,/db_/{/db_/!d}' -e '/case "\$1" in/,/db_/{/db_/!d}' -e '/case "{1}" in/,/db_/{/db_/!d}' -e '/;;/,/esac/{/;;/!d}' postrm
sed -i -e '/[[:blank:]]\{0,\}update-alternatives.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/esac/d' -e '/[[:blank:]]\{0,\}db_.*)/,/update-alternatives/d' -e '/[[:blank:]]\{0,\}lintian.*/,/}/d' -e '/[[:blank:]]\{0,\}if.*update-app-install.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*update-software-center.*/,/fi/d' -e '/[[:blank:]]\{0,\}if.*RET.*/,/fi/d' -e '/.*\*)[[:blank:]]\{0,\}/,/esac/d' postrm
sed -i -e '/.*remove.*)[[:blank:]]\{0,\}$/d' -e '/.*purge.*)[[:blank:]]\{0,\}$/d' -e '/.*upgrade.*)[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/d' -e '/^[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/d' postrm
sed -i -e s'/.*\*)[[:blank:]]{0,\}\(.*\)/\1,/g' -e s'/.*remove.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*purge.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/.*upgrade.*)[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^[[:blank:]]\{0,\};;[[:blank:]]\{0,\}\(.*\)$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit 0[[:blank:]]\{0,\}$/\1/g' -e s'/^\(.*\)[[:blank:]]\{0,\}\(; \)\{0,1\}\( && \)\{0,1\}[[:blank:]]\{0,\}exit[[:blank:]]\{0,\}$/\1/g' postrm
fi
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|abort\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' postrm | while read -r line; do
grep -iv '#!\|set -e\|automatically\|added\|generated\|apt \|apt-get \|aptitude \|debian-policy\|debconf\|dh_installdeb\|debhelper\|preinst\|postinst\|prerm\|postrm\|update-alternatives\|--slave\|db_\|remove_source\|update_manager\|lintian' postrm | while read -r line; do
printf '\t%s\n' "$line" >> tempfile1
done
fi
@ -3175,7 +3205,6 @@ fi
if [[ $pkgbuild != set ]] && [[ $Pkgbuild != set ]]; then
# Removing leftover files
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
cd ..
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 0
@ -3303,17 +3332,7 @@ else
echo "sha512sums=('$(sha512sum "$package_with_full_path" | gawk '{print $1}')')" >> PKGBUILD
fi
echo -e "\npackage(){\n\n # Extract package data" >> PKGBUILD
if [[ $data_tar_check == data.tar.gz ]]; then
echo " tar xzf data.tar.gz -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.xz ]]; then
echo " tar xf data.tar.xz -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.bz2 ]]; then
echo " tar xf data.tar.bz2 -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar.lzma ]]; then
echo " tar xf data.tar.lzma -C \"\${pkgdir}\"" >> PKGBUILD
elif [[ $data_tar_check == data.tar ]]; then
echo " tar xf data.tar -C \"\${pkgdir}\"" >> PKGBUILD
fi
echo " $data_extract -f $data_tar_check -C \"\${pkgdir}\"" >> PKGBUILD
if [[ -e pkgbuildinstallations1 ]] || [[ -e pkgbuildinstallations2 ]] || [[ -e pkgbuildinstallations32 ]] || [[ -e pkgbuildinstallations64 ]]; then
if [[ $(grep '^install' pkgbuildinstallations1 2> /dev/null | wc -l) != $(echo $(($(cat pkgbuildinstallations1 2> /dev/null | wc -l) + $(cat pkgbuildinstallations2 2> /dev/null | wc -l) + $(cat pkgbuildinstallations32 2> /dev/null | wc -l) + $(cat pkgbuildinstallations64 2> /dev/null | wc -l)))) ]]; then
echo -e "\n # Fix directory structure differences\n cd \"\${pkgdir}\"" >> PKGBUILD
@ -3321,43 +3340,43 @@ if [[ -e pkgbuildinstallations1 ]] || [[ -e pkgbuildinstallations2 ]] || [[ -e p
fi
if [[ -e pkgbuildinstallations1 ]]; then
echo >> PKGBUILD
cat pkgbuildinstallations1 | while read line; do
cat pkgbuildinstallations1 | while read -r line; do
echo -e " $line" >> PKGBUILD
done
fi
if [[ $(grep -q "^arch=('i686' 'x86_64')$" PKGBUILD; echo $?) == 0 ]]; then
if [[ -e pkgbuildinstallations32 ]] && [[ -e pkgbuildinstallations64 ]]; then
echo -e "\n if [[ \${CARCH} == i686 ]]; then" >> PKGBUILD
cat pkgbuildinstallations32 | while read line; do
cat pkgbuildinstallations32 | while read -r line; do
echo " $line" >> PKGBUILD
done
echo " elif [[ \${CARCH} == x86_64 ]]; then" >> PKGBUILD
cat pkgbuildinstallations64 | while read line; do
cat pkgbuildinstallations64 | while read -r line; do
echo " $line" >> PKGBUILD
done
echo " fi" >> PKGBUILD
elif [[ -e pkgbuildinstallations32 ]] && [[ ! -e pkgbuildinstallations64 ]]; then
echo -e "\n if [[ \${CARCH} == i686 ]]; then" >> PKGBUILD
cat pkgbuildinstallations32 | while read line; do
cat pkgbuildinstallations32 | while read -r line; do
echo " $line" >> PKGBUILD
done
echo " fi" >> PKGBUILD
elif [[ ! -e pkgbuildinstallations32 ]] && [[ -e pkgbuildinstallations64 ]]; then
echo -e "\n if [[ \${CARCH} == x86_64 ]]; then" >> PKGBUILD
cat pkgbuildinstallations64 | while read line; do
cat pkgbuildinstallations64 | while read -r line; do
echo " $line" >> PKGBUILD
done
echo " fi" >> PKGBUILD
fi
elif [[ $(grep -q "^arch=('x86_64')$" PKGBUILD; echo $?) == 0 ]] && [[ -e pkgbuildinstallations64 ]]; then
echo >> PKGBUILD
cat pkgbuildinstallations64 | while read line; do
cat pkgbuildinstallations64 | while read -r line; do
echo -e " $line" >> PKGBUILD
done
fi
if [[ -e pkgbuildinstallations2 ]]; then
echo >> PKGBUILD
cat pkgbuildinstallations2 | while read line; do
cat pkgbuildinstallations2 | while read -r line; do
echo -e " $line" >> PKGBUILD
done
fi
@ -3374,7 +3393,6 @@ rm -rf "../$pkgname" 2> /dev/null
mkdir "../$pkgname" 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
echo -e "${red}Error: Cannot create PKGBUILD directory, permission denied. Removing leftover files and exiting...${NC}"
cd ..
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 1
@ -3391,7 +3409,6 @@ fi
# Removing leftover files
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"
cd ..
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 0