Compare commits

..

12 Commits

Author SHA1 Message Date
helixarch
7a38d3df70
Add files via upload
Bug fixes
2025-04-17 23:18:09 +03:00
helixarch
1942d4368e
Update README.md 2025-04-17 20:57:02 +03:00
helixarch
af094c7b2b
Update README.md 2025-04-17 20:55:34 +03:00
helixarch
26ed775990
Add files via upload
Bug fixes
2025-04-17 20:51:24 +03:00
helixarch
7c1044c69a
Add files via upload
Added output directory option, fixed bugs
2025-04-14 21:50:18 +03:00
helixarch
23ea2dd4c6
Merge pull request #83 from e-kwsm/SC2116
fix(SC2116): remove useless echo
2025-04-12 07:59:50 +03:00
helixarch
53b48ff8a1
Merge pull request #84 from e-kwsm/SC2006
style(SC2006): Use $(...) notation instead of legacy backticks `...`
2025-04-12 07:59:22 +03:00
Eisuke Kawashima
56e91d001b
fix(SC2116): remove useless echo 2025-03-22 12:18:00 +09:00
Eisuke Kawashima
9eab3a69c5
style(SC2006): Use $(...) notation instead of legacy backticks ... 2025-03-22 12:18:00 +09:00
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
2 changed files with 2424 additions and 2345 deletions

View File

@ -31,7 +31,7 @@ A script for converting .deb packages into Arch Linux packages, focused on accur
**Q: How do I use debtap?**
**A:** The syntax is quite simple actually: `debtap [options] package_filename`
**A:** The syntax is quite simple actually: `Syntax: debtap -o output_directory [other_options] package_filename`
For example: `debtap world-of-goo-demo_1.0_i386.deb`
Any recommendations or questions for debtap are welcomed!
@ -47,4 +47,5 @@ Available options:
-w --wipeout Wipeout versions from all dependencies, conflicts etc.
-p --pkgbuild Additionally generate a PKGBUILD file
-P --Pkgbuild Generate a PKGBUILD file only
-o --output Output directory for generated package and/or pkgbuild (optional)
-v --version     Print version

502
debtap
View File

@ -1,6 +1,6 @@
#!/usr/bin/bash
# Copyright 2014-2022 George Savvidis
# Copyright 2014-2025 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.5.0
Version=3.6.0
# Defining colors and bold letters
lightgreen='\e[1;32m'
@ -23,11 +23,13 @@ lightred='\e[1;31m'
red='\e[0;31m'
lightblue='\e[1;34m'
NC='\e[0m'
bold=`tput bold`
normal=`tput sgr0`
bold=$(tput bold)
normal=$(tput sgr0)
# Options, help, database update and error messages
optionsarray=()
for i in "$@"; do
optionsarray+=($@)
if [[ "$i" =~ ^-([huqQswpPv]*)h([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--help$ ]]; then
help=set
fi
@ -55,12 +57,28 @@ for i in "$@"; do
if [[ "$i" =~ ^-([huqQswpPv]*)v([huqQswpPv]*)$ ]] || [[ "$i" =~ ^--version$ ]]; then
version=set
fi
if [[ "$i" =~ ^-o$ ]] || [[ "$i" =~ ^--output$ ]]; then
output=set
fi
done
if [[ $output == set ]]; then
for i in $(eval echo {0..$((${#optionsarray[@]}-1))}); do
if [[ "${optionsarray[$i]}" =~ ^-o$ ]] || [[ "${optionsarray[$i]}" =~ ^--output$ ]]; then
if [[ "${optionsarray[$i+1]}" == "" ]]; then
echo -e "${red}Error: You haven't specified an output directory${NC}"; exit 1;
elif [ -d "${optionsarray[$i+1]}" ]; then
outputdirectory="${optionsarray[$i+1]}"
else
echo -e "${red}Error: No output directory or invalid output directory${NC}"; exit 1;
fi
fi
done
fi
if [[ $pseudo == set ]] && [[ ! -e /var/lib/pacman/sync/multilib.db ]] && [[ ! -e /var/lib/pacman/sync/multilib-testing.db ]]; then
echo -e "${red}Error: You are either running non-x86_64 Arch Linux, or you haven't enabled multilib repository. If you are running x86_64 Arch Linux, you must enable a multilib repository and then synchronize pacman database${NC}"; exit 1
fi
if [[ $help == set ]]; then
echo -e "Syntax: 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 0
echo -e "Syntax: debtap -o output_directory [other_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 -o --output Output directory for generated package and/or pkgbuild (optional)\n -v --version Print version"; exit 0
elif [[ $version == set ]]; then
echo -e "$Version"; exit 0
elif [[ $update == set ]]; then
@ -71,7 +89,7 @@ elif [[ $update == set ]]; then
chmod 755 /var/cache/debtap
echo -e "${lightgreen}==>${NC} ${bold}Synchronizing pkgfile database...${normal}"
pkgfile -u
if [[ $(echo $?) != 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Synchronizing debtap database...${normal}"
@ -82,7 +100,7 @@ elif [[ $update == set ]]; then
elif [[ "$(uname -m)" == "aarch64" ]]; then
_arch=arm64
fi
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'`
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 -k -C - -f http://ftp.debian.org/debian/dists/sid/non-free/Contents-$_arch.gz > /var/cache/debtap/debian-non-free-packages-files.gz
@ -95,7 +113,7 @@ elif [[ $update == set ]]; then
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
if [[ $? != 0 ]]; then
echo -e "${red}Synchronization failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest virtual packages list...${normal}"
@ -103,13 +121,13 @@ elif [[ $update == set ]]; then
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
if [[ $(echo $?) != 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Downloading latest AUR packages list...${normal}"
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
if [[ $? != 0 ]]; then
echo -e "${red}Downloading failed. Exiting...${NC}"; exit 1
else
echo -e "${lightgreen}==>${NC} ${bold}Generating base group packages list...${normal}"
@ -122,15 +140,15 @@ elif [[ $update == set ]]; then
fi
fi
fi
elif [[ "${@: -1}" == "debtap" ]] || [[ "${@: -1}" =~ /debtap$ ]] || [[ "${@: -1}" =~ ^-([qQswpP]+)$ ]] || [[ "${@: -1}" =~ ^--([quiet|Quiet|pseudo|wipeout|pkgbuild|Pkgbuild]){1,}$ ]]; then
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}" == "debtap" ]] || [[ "${@: -1}" =~ /debtap$ ]] || [[ "${@: -1}" =~ ^-([qQswpPo]+)$ ]] || [[ "${@: -1}" =~ ^--([quiet|Quiet|pseudo|wipeout|pkgbuild|Pkgbuild|output]){1,}$ ]] || [[ "${@: -1}" =~ ^-(o+)$ ]] || [[ "${@: -1}" =~ ^--(output){1,}$ ]] || [[ -d "${@: -1}" ]]; then
echo -e "${red}Error: You haven't specified a deb package${NC}\nSyntax: debtap -o output_directory [other_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 -o --output Output directory for generated package and/or pkgbuild (optional)\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 -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
if [[ ! $(ls /var/cache/pkgfile | egrep '*.files?(.[[:digit:]]{3})' 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
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
else
@ -162,13 +180,12 @@ tar_extract_cmd() {
}
# Defining package with full path & defining and creating working directory
package_with_full_path="`readlink -f "${@: -1}"`"
working_directory="`pwd`/`basename "${@: -1}" | tr '[:upper:]' '[:lower:]' | sed s'/\.deb$//'`-working-directory"
package_with_full_path="$(readlink -f "${@: -1}")"
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
echo -e "${red}Error: Cannot create working directory, permission denied. Exiting...${NC}"
exit 1
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot create working directory, permission denied. Exiting...${NC}"; exit 1
fi
cd "$working_directory"
@ -385,77 +402,77 @@ echo -e "${lightgreen}==>${NC} ${bold}Generating .PKGINFO file...${normal}"
# Generating pkgname field
if [[ $pseudo == set ]] && [[ $(ls -A usr/lib32 2> /dev/null) ]] && [[ ! $(ls -A usr/bin 2> /dev/null) ]]; then
for i in {git,bzr,darcs,hg}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-$(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = lib32-$(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = lib32-$(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = lib32-`grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = lib32-$(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')" | sed s'/--/-/g' > .PKGINFO
fi
else
for i in {git,bzr,darcs,hg}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = $(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-$i | sed s"/-$i-$i$/-$i/" | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q svn; echo $?) == 0 ]]; then
echo "pkgname = $(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-svn | sed s'/-svn-svn$/-svn/' | sed s'/--/-/g' > .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q $i; echo $?) == 0 ]]; then
echo "pkgname = $(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')"-cvs | sed s'/-cvs-cvs$/-cvs/' | sed s'/--/-/g' > .PKGINFO
fi
done
if [[ $(grep -i ^Version: control | gawk '{print $2}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = `grep -i ^Package: control | gawk '{print $2}' | tr '[:upper:]' '[:lower:]'`" | sed s'/demo$/-demo/' | sed s'/trial$/-trial/' | sed s'/--/-/g' > .PKGINFO
if [[ $(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgname = $(grep -i ^Package: control | gawk -F : '{print $2}' | sed s'/^ //' | tr '[:upper:]' '[:lower:]')" | sed s'/demo$/-demo/' | sed s'/trial$/-trial/' | sed s'/--/-/g' > .PKGINFO
fi
fi
# Generating pkgver field
version=$(grep -i ^Version: control | gawk '{print $2}' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//')
version=$(grep -i ^Version: control | gawk -F : '{print $2}' | sed s'/^ //' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//')
for i in {git,bzr,darcs,hg}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = `echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
echo "pkgver = $(echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}')"-1 >> .PKGINFO
fi
done
for i in {svn.r,svnr}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = r`echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
echo "pkgver = r$(echo $version | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}')"-1 >> .PKGINFO
fi
done
if [[ $(echo $version | grep -q svn; echo $?) == 0 ]] && [[ $(echo $version | grep -q "svn\.r\|svnr"; echo $?) != 0 ]]; then
echo "pkgver = `echo $version | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}'`"-1 >> .PKGINFO
echo "pkgver = $(echo $version | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}')"-1 >> .PKGINFO
fi
for i in {cvs,CVS}; do
if [[ $(echo $version | grep -q $i; echo $?) == 0 ]]; then
echo "pkgver = `echo $version | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}'`"-1 >> .PKGINFO
echo "pkgver = $(echo $version | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}')"-1 >> .PKGINFO
fi
done
if [[ $(echo $version | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "pkgver = `echo $version | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./'`"-1 >> .PKGINFO
echo "pkgver = $(echo $version | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./')"-1 >> .PKGINFO
fi
# Generating pkgdesc field
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')
if [[ $(echo $(grep -v ":\| \." control) | grep -iq "$(grep -i ^Description: control | sed -e s'/^Description://i' -e s'/^ //' | 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 -e s'/^Description://i' -e s'/^ //' | 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
# Generating url field
echo "url = `grep -i ^Homepage: control | gawk '{print $2}'`" | sed s'/\/$//' >> .PKGINFO
echo "url = $(grep -i ^Homepage: control | sed -e s'/^Homepage://i' -e s'/^ //')" | sed s'/\/$//' >> .PKGINFO
# Generating builddate (which is actually packaging date) field
echo "builddate = `date -u "+%s"`" >> .PKGINFO
echo "builddate = $(date -u "+%s")" >> .PKGINFO
# Generating packager field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
@ -470,7 +487,7 @@ fi
# Generating arch field
if [[ $pseudo != set ]]; then
echo "arch = `grep -i ^Architecture: control | gawk '{print $2}' | sed -e s'/i386/i686/' -e s'/amd64/x86_64/' -e s'/armhf/armv7h/' -e s'/arm64/aarch64/' -e s'/all/any/'`" >> .PKGINFO
echo "arch = $(grep -i ^Architecture: control | gawk -F : '{print $2}' | sed s'/^ //' | sed -e s'/i386/i686/' -e s'/amd64/x86_64/' -e s'/armhf/armv7h/' -e s'/arm64/aarch64/' -e s'/all/any/')" >> .PKGINFO
else
echo "arch = x86_64" >> .PKGINFO
fi
@ -521,7 +538,7 @@ if [[ -e pkgbuildinstallations64 ]]; then
else
pkgbuildinstallations64_size=0
fi
echo "size =" $((`du -sb | tr -d " ."` - `ls -l | grep control | gawk '{print $5}'` - $preinst_size - $postinst_size - $prerm_size - $postrm_size - $conffiles_size - $pkgbuildinstallations1_size - $pkgbuildinstallations2_size - $pkgbuildinstallations32_size - $pkgbuildinstallations64_size - `ls -la | grep .PKGINFO | gawk '{print $5}'` - 4096)) >> .PKGINFO
echo "size =" $(($(du -sb | tr -d " .") - $(ls -l | grep control | gawk '{print $5}') - $preinst_size - $postinst_size - $prerm_size - $postrm_size - $conffiles_size - $pkgbuildinstallations1_size - $pkgbuildinstallations2_size - $pkgbuildinstallations32_size - $pkgbuildinstallations64_size - $(ls -la | grep .PKGINFO | gawk '{print $5}') - 4096)) >> .PKGINFO
# Generating license field
if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
@ -529,10 +546,10 @@ if [[ $quiet == set ]] || [[ $Quiet == set ]]; then
else
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
for i in $(echo "$package_license" | sed -e s'/ /__/g' -e s'/,/ /g'); do
license+=($i)
done
for (( i=0; i<$(echo ${#license[@]}); i=i+1 )); do
for (( i=0; i<${#license[@]}; i=i+1 )); do
license[$i]=$(echo ${license[$i]} | sed s'/__/ /g')
done
printf '%s\n' "${license[@]}" | while read line; do
@ -544,30 +561,31 @@ echo -e "\n${lightgreen}***${NC} ${bold}Creation of .PKGINFO file in progress. I
# The packages names translator function
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
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
for debian_package_file in `grep "\/$debian_package_name$" /var/cache/debtap/debian-main-packages-files /var/cache/debtap/debian-non-free-packages-files /var/cache/debtap/debian-contrib-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
echo $debian_package_file $(grep "^$debian_package_name$\|^$debian_package_name " `ls | grep initial-check-list` | gawk '{print $2}')
# First method of translating .deb packages names into Arch Linux packages names, more accurate, comparing contents of .deb packages with Arch Linux packages contents
for debian_package_name in $(gawk '{print $1}' $(ls | grep initial-check-list)); do
for debian_package_file in $(grep "/$debian_package_name$" /var/cache/debtap/debian-main-packages-files /var/cache/debtap/debian-non-free-packages-files /var/cache/debtap/debian-contrib-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'); do
echo $debian_package_file $(grep "^$debian_package_name$\|^$debian_package_name " $(ls | grep initial-check-list) | gawk -F : '{print $2}')
done >> $debian_package_name-tempfile03
done
for i in `ls | grep tempfile03`; do
for j in `gawk '{print $1}' $i`; do
for k in `pkgfile -q $j`; do
echo $k`head -1 $i | gawk '{print $2$3}'`
done
done >> `echo $i | sed s'/tempfile03/tempfile04/'`
done
touch tempfile05
for debian_package_name in $(gawk '{print $1}' `ls | grep initial-check-list`); do
for i in $(ls | grep tempfile03); do
for j in $(gawk '{print $1}' $i); do
for k in $(pkgfile -q $j); do
echo $k$(head -1 $i | gawk '{print $2$3}')
done
done >> $(echo $i | sed s'/tempfile03/tempfile04/')
done
touch tempfile05
for debian_package_name in $(gawk '{print $1}' $(ls | grep initial-check-list)); do
grep -q "^$debian_package_name$" tempfile05 || echo $debian_package_name >> tempfile05
done
done
for i in $(for j in `cat tempfile05`; do echo $j-tempfile04; done); do
k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
touch tempfile06
for i in $(for j in $(cat tempfile05); do echo $j-tempfile04; done); do
k=$(sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1)
if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
for l in `cat $i`; do
for l in $(cat $i); do
for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
echo $l | grep "^$m$"
done
@ -577,44 +595,48 @@ for i in $(for j in `cat tempfile05`; do echo $j-tempfile04; done); do
else
echo >> tempfile06
fi
done
done
cat tempfile06 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile07
cat tempfile06 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile07
cat tempfile07 | while read line; do
if [[ $(cat tempfile07 | wc -l) == 0 ]]; then
echo >> tempfile07
fi
cat tempfile07 | while read line; do
if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
echo >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "$line" | gawk '{print $1,$2,$3}' >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
echo "$line" | gawk '{print $1,$2,$3}' >> final-check-list
echo "$line" | gawk '{print $1,$4,$5}' >> final-check-list
fi
done
done
for i in $(eval echo {1..$(cat `ls | grep initial-check-list` | wc -l)}); do
for i in $(eval echo {1..$(cat $(ls | grep initial-check-list) | wc -l)}); do
if [[ $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') == "" ]]; then
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list`) >> untranslated
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | gawk '{print $1}') >> untranslated-names-only
echo $(sed -n ""$i"{p;q;}" $(ls | grep initial-check-list)) >> untranslated
echo $(sed -n ""$i"{p;q;}" $(ls | grep initial-check-list) | gawk '{print $1}') >> untranslated-names-only
elif [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(sed -n ""$i"{p;q;}" final-check-list | gawk '{print $1}') "; echo $?) == 0 ]]; then
echo $(sed -n ""$i"{p;q;}" `ls | grep initial-check-list` | sed s'/ //') >> missing-files
echo $(sed -n ""$i"{p;q;}" $(ls | grep initial-check-list) | sed s'/ //') >> missing-files
fi
done
done
# Second method of translating remaining untranslated .deb packages names into Arch Linux packages names, same as first method, but searches in Ubuntu database for packages contents instead of Debian database
if [[ -e untranslated-names-only ]]; then
# Second method of translating remaining untranslated .deb packages names into Arch Linux packages names, same as first method, but searches in Ubuntu database for packages contents instead of Debian database
if [[ -e untranslated-names-only ]] && [[ $(cat untranslated-names-only 2> /dev/null) != "" ]]; then
for ubuntu_package_name in $(sort -u untranslated-names-only); do
for ubuntu_package_file in `grep "\/$ubuntu_package_name$" /var/cache/debtap/ubuntu-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'`; do
for ubuntu_package_file in $(grep "/$ubuntu_package_name$" /var/cache/debtap/ubuntu-packages-files | grep 'bin\|opt\|\.so' | gawk '{print $1}' | sed s'/\// /g' | gawk '{print $NF}'); do
echo $ubuntu_package_file $(grep "^$ubuntu_package_name$\|^$ubuntu_package_name " untranslated | gawk '{print $2}')
done >> $ubuntu_package_name-tempfile08
done
for i in `ls | grep tempfile08`; do
for j in `gawk '{print $1}' $i`; do
for k in `pkgfile -q $j`; do
echo $k`head -1 $i | gawk '{print $2$3}'`
for i in $(ls | grep tempfile08); do
for j in $(gawk '{print $1}' $i); do
for k in $(pkgfile -q $j); do
echo $k$(head -1 $i | gawk '{print $2$3}')
done
done >> `echo $i | sed s'/tempfile08/tempfile09/'`
done >> $(echo $i | sed s'/tempfile08/tempfile09/')
done
touch tempfile10
@ -622,10 +644,11 @@ if [[ -e untranslated-names-only ]]; then
grep -q "^$ubuntu_package_name$" tempfile10 || echo $ubuntu_package_name >> tempfile10
done
for i in $(for j in `cat tempfile10`; do echo $j-tempfile09; done); do
k=`sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1`
touch tempfile11
for i in $(for j in $(cat tempfile10); do echo $j-tempfile09; done); do
k=$(sort $i | uniq -c | gawk '{print $1}' | sort -n | tail -1)
if [[ $(sort $i | uniq -c | gawk '{print $1}' | sort -n | grep "^$k$" | wc -l) -ge 2 ]]; then
for l in `cat $i`; do
for l in $(cat $i); do
for m in $(sort $i | uniq -c | gawk '{print $1,$2}' | sort -n | grep "^$k " | gawk '{print $2}'); do
echo $l | grep "^$m$"
done
@ -639,14 +662,18 @@ if [[ -e untranslated-names-only ]]; then
cat tempfile11 | sed s'/=/ = /g' | sed s'/>/ > /g' | sed s'/</ < /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' | sed s'/^lib32-\|-multilib$//g' > tempfile12
if [[ $(cat tempfile12 | wc -l) == 0 ]]; then
echo >> tempfile12
fi
cat tempfile12 | while read line; do
if [[ $(echo "$line" | wc -w) -eq 0 ]]; then
echo >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 1 ]] || [[ $(echo "$line" | wc -w) -eq 3 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "$line" | gawk '{print $1,$2,$3}' >> final-check-list
elif [[ $(echo "$line" | wc -w) -eq 5 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}'`" >> final-check-list
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $4}'` `echo "$line" | gawk '{print $5}'`" >> final-check-list
echo "$line" | gawk '{print $1,$2,$3}' >> final-check-list
echo "$line" | gawk '{print $1,$4,$5}' >> final-check-list
fi
done
@ -660,10 +687,10 @@ if [[ -e untranslated-names-only ]]; then
done
rm -rf untranslated untranslated-names-only
fi
fi
# Third method of translating remaining untranslated .deb packages names into Arch Linux packages names, less accurate, comparing .deb packages names with Arch Linux packages names
if [[ -e new-untranslated-names-only ]]; then
# Third method of translating remaining untranslated .deb packages names into Arch Linux packages names, less accurate, comparing .deb packages names with Arch Linux packages names
if [[ -e new-untranslated-names-only ]] && [[ $(cat new-untranslated-names-only 2> /dev/null) != "" ]]; then
for i in $(sort -u new-untranslated-names-only | grep -v python-support); do
j=$(echo "$i" | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//')
@ -2629,7 +2656,7 @@ if [[ -e new-untranslated-names-only ]]; then
grep "^$i$\|^$i " new-untranslated | sed s"/^$i/$(head -1 matches)-$t/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
fi
done
if [[ $(echo "$i" | grep -q '\-svn$\|\-git$\|\-cvs$\|\-bzr$\|\-darcs$\|\-hg$'; echo $?) != 0 ]]; then
if [[ $(echo "$i" | grep -q '\-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$'; echo $?) != 0 ]]; then
grep "^$i$\|^$i " new-untranslated | sed s"/^$i/$(head -1 matches)/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
fi
sed -i "/^$i$\|^$i /d" new-untranslated
@ -2639,25 +2666,25 @@ if [[ -e new-untranslated-names-only ]]; then
done
rm -rf new-untranslated-names-only
fi
fi
# Appending untranslated packages names (if any exist) to the translated packages names list
if [[ $(cat new-untranslated 2> /dev/null | wc -l) -ne 0 ]]; then
# Appending untranslated packages names (if any exist) to the translated packages names list
if [[ -e new-untranslated-names ]] && [[ $(cat new-untranslated-names 2> /dev/null) != "" ]]; then
tac new-untranslated | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
gawk '{print $1}' new-untranslated | sort -u > $(echo `ls | grep initial-check-list` | sed s'/initial-check-list/untranslated-names-only/')
fi
rm -rf new-untranslated
gawk '{print $1}' new-untranslated | sort -u > $(echo $(ls | grep initial-check-list) | sed s'/initial-check-list/untranslated-names-only/')
fi
rm -rf new-untranslated
# Sorting packages with missing files (if any exist)
if [[ -e missing-files ]]; then
sort -u missing-files > $(echo `ls | grep initial-check-list` | sed s'/initial-check-list/missing-files/')
# Sorting packages with missing files (if any exist)
if [[ -e missing-files ]]; then
sort -u missing-files > $(echo $(ls | grep initial-check-list) | sed s'/initial-check-list/missing-files/')
rm -rf missing-files
fi
fi
# Special rules for optional dependencies
if [[ -e optional-dependencies-untranslated-names-only ]]; then
if [[ -e dependencies-untranslated-names-only ]]; then
for i in `cat optional-dependencies-untranslated-names-only`; do
# Special rules for optional dependencies
if [[ -e optional-dependencies-untranslated-names-only ]]; then
if [[ $(cat dependencies-untranslated-names-only) != "" ]]; then
for i in $(cat optional-dependencies-untranslated-names-only); do
if [[ $(grep -q "^$i$" dependencies-untranslated-names-only; echo $?) != 0 ]]; then
echo "$i" >> optional-dependencies-untranslated-names-only-1
fi
@ -2666,19 +2693,19 @@ if [[ -e optional-dependencies-untranslated-names-only ]]; then
else
mv optional-dependencies-untranslated-names-only optional-dependencies-untranslated-names-only-1
fi
fi
fi
# Appending ready translated names (if any needed) to the translated packages names list
grep -q "^fonts-freefont-ttf$\|^fonts-freefont-ttf " tempfile02 && echo ttf-freefont >> final-check-list
grep -q "^fonts-liberation$\|^fonts-liberation " tempfile02 && echo ttf-liberation >> final-check-list
grep -q "^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer " tempfile02 && echo ttf-ms-fonts >> final-check-list
grep -q "^default-jre$\|^default-jre " tempfile02 && echo java-runtime >> final-check-list
grep -q "^python:any$\|^python:any " tempfile02 && echo python >> final-check-list
grep "^openjdk-[0-9]+-jdk$\|^openjdk-[0-9]+-jdk " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jdk/jdk\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^openjdk-[0-9]+-jre\(-headless\)\?$\|^openjdk-[0-9]+-jre\(-headless\)\? " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jre/jre\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^libstdc[0-9]+$\|libstdc[0-9]+ " tempfile02 | sort -uV | tail -1 | sed s"/libstdc\([0-9]\+\)/$(pacman -Ssq libstdc | sort -uV | tail -1)/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^qt[0-9]+-default$\|qt[0-9]+-default " tempfile02 | sed s"/qt\([0-9]\+\)-default/qt\1-base/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
if [[ $pseudo != set ]]; then
# Appending ready translated names (if any needed) to the translated packages names list
grep -q "^fonts-freefont-ttf$\|^fonts-freefont-ttf " tempfile02 && echo ttf-freefont >> final-check-list
grep -q "^fonts-liberation$\|^fonts-liberation " tempfile02 && echo ttf-liberation >> final-check-list
grep -q "^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer " tempfile02 && echo ttf-ms-fonts >> final-check-list
grep -q "^default-jre$\|^default-jre " tempfile02 && echo java-runtime >> final-check-list
grep -q "^python:any$\|^python:any " tempfile02 && echo python >> final-check-list
grep "^openjdk-[0-9]+-jdk$\|^openjdk-[0-9]+-jdk " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jdk/jdk\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^openjdk-[0-9]+-jre\(-headless\)\?$\|^openjdk-[0-9]+-jre\(-headless\)\? " tempfile02 | sort -uV | tail -1 | sed s"/openjdk-\([0-9]\+\)-jre/jre\1-openjdk/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^libstdc[0-9]+$\|libstdc[0-9]+ " tempfile02 | sort -uV | tail -1 | sed s"/libstdc\([0-9]\+\)/$(pacman -Ssq libstdc | sort -uV | tail -1)/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^qt[0-9]+-default$\|qt[0-9]+-default " tempfile02 | sed s"/qt\([0-9]\+\)-default/qt\1-base/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
if [[ $pseudo != set ]]; then
grep -q "^xlibs$\|^xlibs " tempfile02 && echo libx11 >> final-check-list
grep -q "^libgl1$\|^libgl1 " tempfile02 && echo libgl >> final-check-list
grep -q "^libglu1$\|^libglu1 " tempfile02 && echo glu >> final-check-list
@ -2686,7 +2713,7 @@ if [[ $pseudo != set ]]; then
grep "^libpangomm$\|^libpangomm " tempfile02 | sed s"/libpangomm/pangomm/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^libcupsys2$\|^libcupsys2 " tempfile02 | sed s"/libcupsys2/libcups/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^jackd[0-9]*$\|^jackd-[0-9]* " tempfile02 | sort -uV | tail -1 | sed s"/jackd\([0-9]\*\)/jack\1/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
else
else
grep -q "^xlibs$\|^xlibs " tempfile02 && echo lib32-libx11 >> final-check-list
grep -q "^libgl1$\|^libgl1 " tempfile02 && echo lib32-libgl >> final-check-list
grep -q "^libglu1$\|^libglu1 " tempfile02 && echo lib32-glu >> final-check-list
@ -2694,42 +2721,45 @@ else
grep "^libpangomm$\|^libpangomm " tempfile02 | sed s"/libpangomm/lib32-pangomm/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^libcupsys2$\|^libcupsys2 " tempfile02 | sed s"/libcupsys2/lib32-libcups/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
grep "^jackd[0-9]*$\|^jackd-[0-9]* " tempfile02 | sort -uV | tail -1 | sed s"/jackd\([0-9]\*\)/lib32-jack\1/g" | sed s'/=/= /g' | sed s'/>/> /g' | sed s'/</< /g' | sed s'/> =/>=/g' | sed s'/< =/<=/g' >> final-check-list
fi
fi
# Stripping unnecessary symbols and words from packages versions
grep -v "^$" final-check-list | while read line; do
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | sed s'/^[^:]*://' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//'`" >> tempfile13
done
# Stripping unnecessary symbols and words from packages versions
touch tempfile13
grep -v "^$" final-check-list | while read line; do
echo "$(echo "$line" | gawk '{print $1}') $(echo "$line" | gawk '{print $2}') $(echo "$line" | gawk '{print $3}' | sed s'/^[^:]*://' | sed -e s'/[+~]/-/g' -e s'/[-._]alpha/alpha/' -e s'/[-._]beta/beta/' -e s'/[-._]pre/pre/' -e s'/[-._]rc/rc/' -e s'/[-._]dfsg/dfsg/' | gawk -F 'dev' '{print $1}' | sed -e s'/-\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+\.[0-9]\+//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]\+\.[0-9]\+\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/-[0-9]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]\+\.[0-9]\+[a-z]*[0-9]*//g' -e s'/[a-z]*\(ubuntu\|debian\|build\|dfsg\|nobinonly\|ppa\|nmu\|deb\)[0-9]*[a-z]*[0-9]*//g' -e s'/--/-/g' -e s'/\.\././g' | sed s'/\.$//')" >> tempfile13
done
# Special rules for version control systems
cat tempfile13 | while read line; do
# Special rules for version control systems
touch tempfile14
cat tempfile13 | while read line; do
for i in {git,bzr,darcs,hg}; do
if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
echo "$(echo `echo "$line" | gawk '{print $1}'`-$i | sed s"/-$i-$i$/-$i/") `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
echo "$(echo $(echo "$line" | gawk '{print $1}')-$i | sed s"/-$i-$i$/-$i/") $(echo "$line" | gawk '{print $2}') $(echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}')" >> tempfile14
fi
done
for i in {svn.r,svnr}; do
if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
echo "$(echo `echo "$line" | gawk '{print $1}'`-svn | sed s'/-svn-svn$/-svn/') `echo "$line" | gawk '{print $2}'` r`echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
echo "$(echo $(echo "$line" | gawk '{print $1}')-svn | sed s'/-svn-svn$/-svn/') $(echo "$line" | gawk '{print $2}') r$(echo "$line" | gawk '{print $3}' | gawk -F "$i" '{print $2}' | gawk -F '-' '{print $1}')" >> tempfile14
fi
done
if [[ $(echo "$line" | gawk '{print $3}' | grep -q svn; echo $?) == 0 ]] && [[ $(echo "$line" | gawk '{print $3}' | grep -q "svn\.r\|svnr"; echo $?) != 0 ]]; then
echo "$(echo `echo "$line" | gawk '{print $1}'`-svn | sed s'/-svn-svn$/-svn/') `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}'`" >> tempfile14
echo "$(echo $(echo "$line" | gawk '{print $1}')-svn | sed s'/-svn-svn$/-svn/') $(echo "$line" | gawk '{print $2}') $(echo "$line" | gawk '{print $3}' | gawk -F 'svn' '{print $2}' | gawk -F '-' '{print $1}')" >> tempfile14
fi
for i in {cvs,CVS}; do
if [[ $(echo "$line" | gawk '{print $3}' | grep -q $i; echo $?) == 0 ]]; then
echo "$(echo `echo "$line" | gawk '{print $1}'`-cvs | sed s'/-cvs-cvs$/-cvs/') `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}'`" >> tempfile14
echo "$(echo $(echo "$line" | gawk '{print $1}')-cvs | sed s'/-cvs-cvs$/-cvs/') $(echo "$line" | gawk '{print $2}') $(echo "$line" | gawk '{print $3}' | sed -e s"/[-.]$i/ /g" -e s"/$i/ /g" -e s"/-/ /g" | gawk '{print $2}')" >> tempfile14
fi
done
if [[ $(echo "$line" | gawk '{print $3}' | grep -q "svn\|git\|cvs\|CVS\|bzr\|darcs\|hg"; echo $?) != 0 ]]; then
echo "`echo "$line" | gawk '{print $1}'` `echo "$line" | gawk '{print $2}'` `echo "$line" | gawk '{print $3}' | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./'`" >> tempfile14
echo "$(echo "$line" | gawk '{print $1}') $(echo "$line" | gawk '{print $2}') $(echo "$line" | gawk '{print $3}' | gawk -F '-[0-9]' '{print $1}' | sed s'/-/./')" >> tempfile14
fi
done
done
if [[ $pseudo != set ]]; then
if [[ $pseudo != set ]]; then
mv tempfile14 tempfile15
else
else
# Special rules for multilib packages
touch tempfile15
cat tempfile14 | while read line; do
i=$(echo "$line" | gawk '{print $1}')
pacman -Ssq "lib32-$i" > result
@ -2737,13 +2767,13 @@ else
grep -q "^lib32-$i$" result /var/cache/debtap/aur-packages || echo "$line" >> tempfile15
done
rm -rf result
fi
fi
# Special rules for non optional dependencies
if [[ -e dependencies-initial-check-list ]]; then
# Special rules for non optional dependencies
if [[ -e dependencies-initial-check-list ]]; then
grep -q qt tempfile15 && echo hicolor-icon-theme >> tempfile15
grep -q gtk tempfile15 && echo -e "hicolor-icon-theme\ndesktop-file-utils" >> tempfile15
grep -q ^Python-Version: control && echo python`grep ^Python-Version: control | gawk '{print $2}' | sed s'/\.//g'` >> tempfile15
grep -q ^Python-Version: control && echo python$(grep ^Python-Version: control | gawk '{print $2}' | sed s'/\.//g') >> tempfile15
# Fourth method of finding packages names exclusively for non-optional dependencies (accurate)
for i in $(readelf -d $(find ./ -executable -type f) 2> /dev/null | grep NEEDED | gawk '{print $5}' | sort -u | sed s'/\[\|\]//g'); do
pkgfile -q "$i" | head -1 >> tempfile15
@ -2756,41 +2786,41 @@ if [[ -e dependencies-initial-check-list ]]; then
fi
done
mv tempfile15-1 tempfile15
fi
fi
# Sorting packages names and versions
sort -u tempfile15 > tempfile16
# Sorting packages names and versions
sort -u tempfile15 > tempfile16
# Sorting only packages names
gawk '{print $1}' tempfile16 | sort -u > tempfile17
# Sorting only packages names
gawk '{print $1}' tempfile16 | sort -u > tempfile17
# Removing packages names that are the same with the name of the package to be converted from translated packages list (if any exist)
touch tempfile18
for i in `cat tempfile17`; do
# Removing packages names that are the same with the name of the package to be converted from translated packages list (if any exist)
touch tempfile18
for i in $(cat tempfile17); do
if [[ $(echo " $(echo $(grep ^pkgname .PKGINFO | gawk '{print $3}' | sed s'/-svn$\|-git$\|-cvs$\|-bzr$\|-darcs$\|-hg$//'){-svn,-git,-cvs,-bzr,-darcs,-hg,}) " | grep -q " $(echo $i | sed s'/^lib32-\|-multilib$//') "; echo $?) != 0 ]]; then
echo "$i" >> tempfile18
grep "^$i$\|^$i " tempfile16 >> $i-tempfile19
fi
done
done
touch tempfile22
if [[ $wipeout != set ]] && [[ $(ls *-tempfile19 &> /dev/null; echo $?) == 0 ]]; then
touch tempfile22
if [[ $wipeout != set ]] && [[ $(ls *-tempfile19 &> /dev/null; echo $?) == 0 ]]; then
# Isolating versions from packages
for i in `ls | grep tempfile19`; do
for i in $(ls | grep tempfile19); do
if [[ $(grep -q "=\|>\|<" $i; echo $?) != 0 ]]; then
cat $i >> `echo $i | sed s'/tempfile19/tempfile21/'`
cat $i >> $(echo $i | sed s'/tempfile19/tempfile21/')
else
cat $i | while read line; do
echo $line | gawk '{print $3}' | sed -e s'/\.[a-z]/ /g' -e s'/[a-z]/ /g' | gawk '{print $1}' >> `echo $i | sed s'/tempfile19/tempfile20/'`
echo $line | gawk '{print $3}' | sed -e s'/\.[a-z]/ /g' -e s'/[a-z]/ /g' | gawk '{print $1}' >> $(echo $i | sed s'/tempfile19/tempfile20/')
done
fi
done
# Sorting versions for each package
for i in `ls | grep tempfile20`; do
j=`echo $i | sed s'/tempfile20/tempfile19/'`
k=`echo $i | sed s'/tempfile20/tempfile21/'`
for l in `sort -uV $i | grep -v "^$"`; do
for i in $(ls | grep tempfile20); do
j=$(echo $i | sed s'/tempfile20/tempfile19/')
k=$(echo $i | sed s'/tempfile20/tempfile21/')
for l in $(sort -uV $i | grep -v "^$"); do
grep -q "$l[a-z]\+" $j && grep "$l[a-z]\+" $j | sort -V >> $k
grep -q "$l$" $j && grep "$l$" $j >> $k
grep -q "$l\.[a-z]\+" $j && grep "$l\.[a-z]\+" $j | sort -V >> $k
@ -2798,7 +2828,7 @@ if [[ $wipeout != set ]] && [[ $(ls *-tempfile19 &> /dev/null; echo $?) == 0 ]];
done
# Choosing the appropriate version for each package
for i in `ls | grep tempfile21`; do
for i in $(ls | grep tempfile21); do
if [[ $(grep -q "=\|>\|<" $i; echo $?) != 0 ]]; then
cat $i >> tempfile22
elif [[ $(grep -q "=" $i; echo $?) == 0 ]] && [[ $(grep -q ">\|<" $i; echo $?) != 0 ]]; then
@ -2812,7 +2842,7 @@ if [[ $wipeout != set ]] && [[ $(ls *-tempfile19 &> /dev/null; echo $?) == 0 ]];
grep "<" $i | head -1 | sed s'/ //g' >> tempfile22
fi
done
fi
fi
}
# Generating replacements fields
@ -2824,14 +2854,18 @@ if [[ $(grep -q ^Replaces: control; echo $?) == 0 ]]; then
done
sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
grep -v '^xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > replacements-initial-check-list
if [[ $(cat replacements-initial-check-list | wc -l) == 0 ]]; then
echo >> replacements-initial-check-list
fi
packages-names-translator
if [[ $wipeout != set ]]; then
for i in `sort -u tempfile22`; do echo "replaces = $i" >> .PKGINFO; done
for i in $(sort -u tempfile22); do echo "replaces = $i" >> .PKGINFO; done
else
for i in `sort -u tempfile18`; do echo "replaces = $i" >> .PKGINFO; done
for i in $(sort -u tempfile18); do echo "replaces = $i" >> .PKGINFO; done
fi
rm -rf *tempfile* replacements-initial-check-list final-check-list
fi
touch replacements-untranslated-names-only
# Generating conflicts fields
if [[ $(grep -q ^Conflicts: control; echo $?) == 0 ]]; then
@ -2842,14 +2876,18 @@ if [[ $(grep -q ^Conflicts: control; echo $?) == 0 ]]; then
done
sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > conflicts-initial-check-list
if [[ $(cat conflicts-initial-check-list | wc -l) == 0 ]]; then
echo >> conflicts-initial-check-list
fi
packages-names-translator
if [[ $wipeout != set ]]; then
for i in `sort -u tempfile22`; do echo "conflict = $i" >> .PKGINFO; done
for i in $(sort -u tempfile22); do echo "conflict = $i" >> .PKGINFO; done
else
for i in `sort -u tempfile18`; do echo "conflict = $i" >> .PKGINFO; done
for i in $(sort -u tempfile18); do echo "conflict = $i" >> .PKGINFO; done
fi
rm -rf *tempfile* conflicts-initial-check-list final-check-list
fi
touch conflicts-untranslated-names-only
# Generating provisions fields
if [[ $(grep -q ^Provides: control; echo $?) == 0 ]]; then
@ -2860,14 +2898,18 @@ if [[ $(grep -q ^Provides: control; echo $?) == 0 ]]; then
done
sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > provisions-initial-check-list
if [[ $(cat provisions-initial-check-list | wc -l) == 0 ]]; then
echo >> provisions-initial-check-list
fi
packages-names-translator
if [[ $wipeout != set ]] && [[ $pkgbuild != set ]] && [[ $Pkgbuild != set ]]; then
for i in `sort -u tempfile22`; do echo "provides = $i" >> .PKGINFO; done
for i in $(sort -u tempfile22); do echo "provides = $i" >> .PKGINFO; done
else
for i in `sort -u tempfile18`; do echo "provides = $i" >> .PKGINFO; done
for i in $(sort -u tempfile18); do echo "provides = $i" >> .PKGINFO; done
fi
rm -rf *tempfile* provisions-initial-check-list final-check-list
fi
touch provisions-untranslated-names-only
# Generating backups fields
if [[ -e conffiles ]]; then
@ -2881,7 +2923,7 @@ if [[ -e conffiles ]]; then
else
sed -i -e s'/^bin\//usr\/bin\//g' -e s'/^sbin\//usr\/bin\//g' -e s'/^usr\/sbin\//usr\/bin\//g' -e s'/^usr\/games\//usr\/bin\//g' -e s'/^lib\//usr\/lib32\//g' -e s'/^lib32\//usr\/lib32\//g' -e s'/^usr\/lib\//usr\/lib32\//g' -e s'/^usr\/local\/sbin\//usr\/bin\//g' -e s'/^usr\/local\/games\//usr\/bin\//g' -e s'/^usr\/local\/lib\//usr\/lib32\//g' -e s'/^usr\/local\//usr\//g' tempfile
fi
for i in `sort -u tempfile`; do echo "backup = $i" >> .PKGINFO; done
for i in $(sort -u tempfile); do echo "backup = $i" >> .PKGINFO; done
rm -rf tempfile
fi
@ -2894,14 +2936,18 @@ if [[ $(grep -q '^Depends:\|^Pre-Depends:' control; echo $?) == 0 ]]; then
done
sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > dependencies-initial-check-list
if [[ $(cat dependencies-initial-check-list | wc -l) == 0 ]]; then
echo >> dependencies-initial-check-list
fi
packages-names-translator
if [[ $wipeout != set ]]; then
for i in `sort -u tempfile22`; do echo "depend = $i" >> .PKGINFO; done
for i in $(sort -u tempfile22); do echo "depend = $i" >> .PKGINFO; done
else
for i in `sort -u tempfile18`; do echo "depend = $i" >> .PKGINFO; done
for i in $(sort -u tempfile18); do echo "depend = $i" >> .PKGINFO; done
fi
rm -rf *tempfile* dependencies-initial-check-list final-check-list
fi
touch dependencies-untranslated-names-only
# Generating optional dependencies fields
if [[ $(grep -q '^Recommends:\|^Suggests:' control; echo $?) == 0 ]]; then
@ -2912,16 +2958,19 @@ if [[ $(grep -q '^Recommends:\|^Suggests:' control; echo $?) == 0 ]]; then
done
sed -e s'/(/ /g' -e s'/)//g' tempfile01 | sort > tempfile02
grep -v 'xlibs$\|^xlibs \|^libgl1$\|^libgl1 \|^libglu1$\|^libglu1 \|^default-jre$\|^default-jre \|^openjdk-[0-9]+-[jdk|jre]\|^libstdc[0-9]+$\|^libstdc[0-9]+ \|^qt[0-9]+-default$\|^qt[0-9]+-default \|^python:any$\|^python:any \|^libpango\|^libcupsys2$\|^libcupsys2 \|^jackd[0-9]*$\|^jackd[0-9]* \|^fonts-freefont-ttf$\|^fonts-freefont-ttf \|^fonts-liberation$\|^fonts-liberation \|^ttf-mscorefonts-installer$\|^ttf-mscorefonts-installer \|^dpkg$\|^dpkg \|^apt$\|^apt \|^apt-get$\|^apt-get \|^aptitude$\|^aptitude \|^debconf' tempfile02 > optional-dependencies-initial-check-list
if [[ $(cat optional-dependencies-initial-check-list | wc -l) == 0 ]]; then
echo >> optional-dependencies-initial-check-list
fi
packages-names-translator
if [[ $wipeout != set ]]; then
for i in `sort -u tempfile22`; do
for i in $(sort -u tempfile22); do
j=$(echo $i | sed s'/=\|>\|</ /' | gawk '{print $1}')
if [[ $(grep -q "^depend = $j$\|^depend = $j[=|>|<]" .PKGINFO; echo $?) != 0 ]]; then
echo "optdepend = $i" >> .PKGINFO
fi
done
else
for i in `sort -u tempfile18`; do
for i in $(sort -u tempfile18); do
if [[ $(grep -q "^depend = $i$\|^depend = $i[=|>|<]" .PKGINFO; echo $?) != 0 ]]; then
echo "optdepend = $i" >> .PKGINFO
fi
@ -2929,60 +2978,61 @@ if [[ $(grep -q '^Recommends:\|^Suggests:' control; echo $?) == 0 ]]; then
fi
rm -rf *tempfile* optional-dependencies-initial-check-list final-check-list
fi
touch optional-dependencies-untranslated-names-only-1
# Moving report files to /tmp/debtap (if any exist)
# Moving report files to /tmp/debtap
rm -rf /tmp/debtap 2> /dev/null
mkdir /tmp/debtap 2> /dev/null
if [[ $(echo $?) != 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot create /tmp/debtap, permission denied${NC}"
fi
mv *untranslated* /tmp/debtap 2> /dev/null
mv *missing-files /tmp/debtap 2> /dev/null
# Report of (warning messages for) untranslated packages names and packages with missing files (if any exist)
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]]; then
echo -e "\n${lightred}Warning: These dependencies (depend = fields) could not be translated into Arch Linux packages names:${NC}"
echo `cat /tmp/debtap/dependencies-untranslated-names-only` | sed s'/ /, /g'
echo $($(cat /tmp/debtap/dependencies-untranslated-names-only)) | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/dependencies-missing-files ]]; then
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]]; then
echo -e "${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
else
echo -e "\n${lightred}Warning: These packages names could not be included as dependencies, because debtap has translated them into the same name with the package for conversion. This happens sometimes when you convert packages that already exist in your repositories (which is a bad idea in general). The following packages contain files that are already included in the package from your repositories (without these files your converted package may be dysfunctional):${NC}"
fi
echo `cat /tmp/debtap/dependencies-missing-files` | sed s'/ /, /g'
echo $(cat /tmp/debtap/dependencies-missing-files) | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]]; then
if [[ $(cat /tmp/debtap/optional-dependencies-untranslated-names-only-1) != "" ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]] || [[ -e /tmp/debtap/dependencies-missing-files ]]; then
echo -e "${lightred}Warning: These optional dependencies (optdepend = fields) could not be translated into Arch Linux packages names:${NC}"
else
echo -e "\n${lightred}Warning: These optional dependencies (optdepend = fields) could not be translated into Arch Linux packages names:${NC}"
fi
echo `cat /tmp/debtap/optional-dependencies-untranslated-names-only-1` | sed s'/ /, /g'
echo $($(cat /tmp/debtap/optional-dependencies-untranslated-names-only-1)) | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]]; then
if [[ $(cat /tmp/debtap/replacements-untranslated-names-only) != "" ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ $(cat /tmp/debtap/optional-dependencies-untranslated-names-only-1) != "" ]]; then
echo -e "${lightred}Warning: These replacements (replaces = fields) could not be translated into Arch Linux packages names:${NC}"
else
echo -e "\n${lightred}Warning: These replacements (replaces = fields) could not be translated into Arch Linux packages names:${NC}"
fi
echo `cat /tmp/debtap/replacements-untranslated-names-only` | sed s'/ /, /g'
echo $($(cat /tmp/debtap/replacements-untranslated-names-only)) | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]]; then
if [[ $(cat /tmp/debtap/conflicts-untranslated-names-only) != "" ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ $(cat /tmp/debtap/optional-dependencies-untranslated-names-only-1) != "" ]] || [[ $(cat /tmp/debtap/replacements-untranslated-names-only) != "" ]]; then
echo -e "${lightred}Warning: These conflicts (conflict = fields) could not be translated into Arch Linux packages names:${NC}"
else
echo -e "\n${lightred}Warning: These conflicts (conflict = fields) could not be translated into Arch Linux packages names:${NC}"
fi
echo `cat /tmp/debtap/conflicts-untranslated-names-only` | sed s'/ /, /g'
echo $($(cat /tmp/debtap/conflicts-untranslated-names-only)) | sed s'/ /, /g'
fi
if [[ -e /tmp/debtap/provisions-untranslated-names-only ]]; then
if [[ -e /tmp/debtap/dependencies-untranslated-names-only ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ -e /tmp/debtap/optional-dependencies-untranslated-names-only-1 ]] || [[ -e /tmp/debtap/replacements-untranslated-names-only ]] || [[ -e /tmp/debtap/conflicts-untranslated-names-only ]]; then
if [[ $(cat /tmp/debtap/provisions-untranslated-names-only) != "" ]]; then
if [[ $(cat /tmp/debtap/dependencies-untranslated-names-only) != "" ]] || [[ -e /tmp/debtap/dependencies-missing-files ]] || [[ $(cat /tmp/debtap/optional-dependencies-untranslated-names-only-1) != "" ]] || [[ $(cat /tmp/debtap/replacements-untranslated-names-only) != "" ]] || [[ $(cat /tmp/debtap/conflicts-untranslated-names-only) != "" ]]; then
echo -e "${lightred}Warning: These provisions (provides = fields) could not be translated into Arch Linux packages names:${NC}"
else
echo -e "\n${lightred}Warning: These provisions (provides = fields) could not be translated into Arch Linux packages names:${NC}"
fi
echo `cat /tmp/debtap/provisions-untranslated-names-only` | sed s'/ /, /g'
echo $($(cat /tmp/debtap/provisions-untranslated-names-only)) | sed s'/ /, /g'
fi
# Generating .INSTALL file (if necessary)
@ -3004,7 +3054,7 @@ if [[ -e preinst ]]; then
done
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
if [[ $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15)) != $(($(wc -c < tempfile1) - $(wc -l < tempfile1))) ]]; then
cat tempfile1 >> tempfile2
fi
@ -3030,7 +3080,7 @@ if [[ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) == 0 ]]; then
echo -e '\tupdate-desktop-database -q' >> tempfile1
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 16))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
if [[ $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 16)) != $(($(wc -c < tempfile1) - $(wc -l < tempfile1))) ]]; then
cat tempfile1 >> tempfile2
fi
@ -3060,7 +3110,7 @@ if [[ -e prerm ]]; then
done
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 14))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
if [[ $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 14)) != $(($(wc -c < tempfile1) - $(wc -l < tempfile1))) ]]; then
cat tempfile1 >> tempfile2
fi
@ -3086,7 +3136,7 @@ if [[ $(grep '^depend' .PKGINFO | grep -q 'qt\|gtk'; echo $?) == 0 ]]; then
echo -e '\tupdate-desktop-database -q' >> tempfile1
fi
echo "}" >> tempfile1
if [[ $(echo $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15))) != $(echo $(($(wc -c < tempfile1) - $(wc -l < tempfile1)))) ]]; then
if [[ $(($(grep "[[:blank:]]" -o tempfile1 | wc -l) + 15)) != $(($(wc -c < tempfile1) - $(wc -l < tempfile1))) ]]; then
cat tempfile1 >> tempfile2
fi
IFS=$SAVEIFS
@ -3127,7 +3177,7 @@ if [[ -e tempfile2 ]]; then
sed -i -e s"/ \[\[ \"\$1\" = \"$i\" \]\] &&\| && \[\[ \"\$1\" = \"$i\" \]\]//g" -e s"/ \[ \"\$1\" = \"$i\" \] &&\| && \[ \"\$1\" = \"$i\" \]//g" -e s"/ \[\[ \"\${1}\" = \"$i\" \]\] &&\| && \[\[ \"\${1}\" = \"$i\" \]\]//g" -e s"/ \[ \"\${1}\" = \"$i\" \] &&\| && \[ \"\${1}\" = \"$i\" \]//g" -e s"/ \[\[ \"\$1\" = $i \]\] &&\| && \[\[ \"\$1\" = $i \]\]//g" -e s"/ \[ \"\$1\" = $i \] &&\| && \[ \"\$1\" = $i \]//g" -e s"/ \[\[ \"\${1}\" = $i \]\] &&\| && \[\[ \"\${1}\" = $i \]\]//g" -e s"/ \[ \"\${1}\" = $i \] &&\| && \[ \"\${1}\" = $i \]//g" tempfile2
done
sed -e s'/-x "`which update-menus 2> \/dev\/null`"\|-x "`which update-menus 2>\/dev\/null`"/-f usr\/bin\/update-mime-database/g' -e s'/update-menus/update-mime-database usr\/share\/mime \&> \/dev\/null/g' -e s'/dpkg --listfiles\|dpkg -L/pacman -Qql/g' -e s'/ dash / bash /g' tempfile2 > .INSTALL
sed -e s'/-x "$(which update-menus 2> \/dev\/null)"\|-x "$(which update-menus 2>\/dev\/null)"/-f usr\/bin\/update-mime-database/g' -e s'/update-menus/update-mime-database usr\/share\/mime \&> \/dev\/null/g' -e s'/dpkg --listfiles\|dpkg -L/pacman -Qql/g' -e s'/ dash / bash /g' tempfile2 > .INSTALL
fi
rm -rf tempfile*
@ -3181,10 +3231,20 @@ bsdtar -czf .MTREE --format=mtree --options='!all,use-set,type,uid,gid,mode,time
if [[ $Pkgbuild != set ]]; then
echo -e "\n${lightgreen}==>${NC} ${bold}Creating final package...${normal}"
fakeroot << EOF
tar --force-local -pcf `grep '^pkgname =' .PKGINFO | gawk '{print $3}'`-`grep '^pkgver =' .PKGINFO | gawk '{print $3}'`-`grep '^arch =' .PKGINFO | gawk '{print $3}'`.pkg.tar --exclude='pkgbuildinstallations*' * .PKGINFO .INSTALL .MTREE 2> /dev/null
tar --force-local -pcf $(grep '^pkgname =' .PKGINFO | gawk '{print $3}')-$(grep '^pkgver =' .PKGINFO | gawk '{print $3}')-$(grep '^arch =' .PKGINFO | gawk '{print $3}').pkg.tar --exclude='pkgbuildinstallations*' * .PKGINFO .INSTALL .MTREE 2> /dev/null
zstd -q -T0 --ultra -20 *.tar
EOF
mv *.zst "$(dirname "$package_with_full_path")"
if [[ $output == set ]]; then
mv *.zst "$outputdirectory"
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot move generated package to output directory, permission denied. Exiting...${NC}"; exit 1
fi
else
mv *.zst "$(dirname "$package_with_full_path")"
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot move generated package to the same directory as .deb package, permission denied. Exiting...${NC}"; exit 1
fi
fi
fi
# Announcement of successful creation of package
@ -3324,7 +3384,7 @@ fi
echo -e "\npackage(){\n\n # Extract package data" >> PKGBUILD
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
if [[ $(grep '^install' pkgbuildinstallations1 2> /dev/null | wc -l) != $(($(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
fi
fi
@ -3371,7 +3431,7 @@ if [[ -e pkgbuildinstallations2 ]]; then
done
fi
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
if [[ $(grep '^install' pkgbuildinstallations1 2> /dev/null | wc -l) != $(($(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 cd .." >> PKGBUILD
fi
fi
@ -3379,22 +3439,40 @@ echo -e "\n}" >> PKGBUILD
# Moving PKGBUILD (and .INSTALL, if it exists) and announcing its creation
pkgname="$(grep '^pkgname=' PKGBUILD | sed s'/^pkgname=//')"
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}"
if [[ $output == set ]]; then
pkgbuild_location="$(dirname "$outputdirectory/$pkgname-PKGBUILD")"
rm -rf "$pkgbuilt_location" 2> /dev/null
mkdir "$pkgbuilt_location" 2> /dev/null
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot create PKGBUILD directory to output directory, permission denied. Removing leftover files and exiting...${NC}"
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 1
fi
mv PKGBUILD "../$pkgname"
pkgbuild_with_full_path="$(readlink -f "../$pkgname/PKGBUILD")"
pkgbuild_location="$(dirname "$pkgbuild_with_full_path")"
if [[ -e .INSTALL ]]; then
mv .INSTALL "../$pkgname/$pkgname.install"
fi
mv PKGBUILD "$pkgbuild_location"
if [[ -e .INSTALL ]]; then
mv .INSTALL "$pkgbuild_location/$pkgname.install"
echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD and "$pkgname.install" are now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
else
else
echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD is now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
fi
else
pkgbuild_location="$(dirname ""$(dirname "$package_with_full_path")"/$pkgname-PKGBUILD")"
rm -rf "$pkgbuilt_location" 2> /dev/null
mkdir "$pkgbuilt_location" 2> /dev/null
if [[ $? != 0 ]]; then
echo -e "${red}Error: Cannot create PKGBUILD directory to the same directory as .deb package, permission denied. Removing leftover files and exiting...${NC}"
rm -rf "$working_directory"
rm -rf /tmp/debtap
exit 1
fi
mv PKGBUILD "$pkgbuild_location"
if [[ -e .INSTALL ]]; then
mv .INSTALL "$pkgbuild_location/$pkgname.install"
echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD and "$pkgname.install" are now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
else
echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD is now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
fi
fi
# Removing leftover files