Merge pull request #98 from fedefrancescon/patch-1

fix: pkgbuild generation
This commit is contained in:
helixarch 2025-05-02 16:24:43 +03:00 committed by GitHub
commit bd6a07527d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

27
debtap
View File

@ -3440,40 +3440,27 @@ echo -e "\n}" >> PKGBUILD
# Moving PKGBUILD (and .INSTALL, if it exists) and announcing its creation # Moving PKGBUILD (and .INSTALL, if it exists) and announcing its creation
pkgname="$(grep '^pkgname=' PKGBUILD | sed s'/^pkgname=//')" pkgname="$(grep '^pkgname=' PKGBUILD | sed s'/^pkgname=//')"
if [[ $output == set ]]; then if [[ $output == set ]]; then
pkgbuild_location="$(dirname "$outputdirectory/$pkgname-PKGBUILD")" pkgbuild_location="$outputdirectory"
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 "$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}" pkgbuild_location= "$(dirname "$package_with_full_path")"
fi fi
else pkgbuild_location="$pkgbuild_location/$pkgname-PKGBUILD"
pkgbuild_location="$(dirname ""$(dirname "$package_with_full_path")"/$pkgname-PKGBUILD")" rm -rf "$pkgbuild_location" 2> /dev/null
rm -rf "$pkgbuilt_location" 2> /dev/null mkdir "$pkgbuild_location" 2> /dev/null
mkdir "$pkgbuilt_location" 2> /dev/null echo "pkgbuild_location = $pkgbuild_location"
if [[ $? != 0 ]]; then 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}" 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 "$working_directory"
rm -rf /tmp/debtap rm -rf /tmp/debtap
exit 1 exit 1
fi fi
mv PKGBUILD "$pkgbuild_location" mv PKGBUILD "$pkgbuild_location/PKGBUILD"
if [[ -e .INSTALL ]]; then if [[ -e .INSTALL ]]; then
mv .INSTALL "$pkgbuild_location/$pkgname.install" 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}" 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}" echo -e "${lightgreen}==>${NC} ${bold}PKGBUILD is now located in${normal} ${lightblue}\"$pkgbuild_location\"${NC} ${bold}and ready to be edited${normal}"
fi fi
fi
# Removing leftover files # Removing leftover files
echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}" echo -e "${lightgreen}==>${NC} ${bold}Removing leftover files...${normal}"