Additional improvements to the debian build + a setup command built into ncc

This commit is contained in:
Netkas 2023-10-06 05:18:24 -04:00
parent 5b57f12365
commit b102089d80
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
6 changed files with 156 additions and 4 deletions

View file

@ -11,7 +11,7 @@ Vcs-Git: https://git.n64.cc/nosial/ncc.git
Vcs-Browser: https://git.n64.cc/nosial/ncc
Name: Nosial Code Compiler
Architecture: all
Depends: php (>= 8.0), php-mbstring, php-common, php-ctype, php-curl, zlib1g, php-zip
Depends: shared-mime-info, php (>= 8.0), php-mbstring, php-common, php-ctype, php-curl, zlib1g, php-zip
Description: Nosial Code Compiler is a multi-purpose compiler, package manager, and toolkit written in PHP.
NCC (Nosial Code Compiler) is a versatile tool designed for various tasks related to PHP development.
It allows you to compile PHP code, manage packages, and perform various tasks in a PHP-centric environment.

View file

@ -1,2 +1,33 @@
#!/bin/bash
update-mime-database /usr/share/mime
set -e
# Update MIME database
if ! update-mime-database /usr/share/mime; then
echo "Error: Failed to update MIME database"
exit 1
fi
# Ensure PHP is installed
PHP_BIN=$(command -v php)
if [ -z "$PHP_BIN" ]; then
echo "Error: PHP binary not found"
exit 1
fi
# Create symlink for ncc-cli
ENTRY_POINT="/usr/bin/ncc"
if ! cat <<EOF > "$ENTRY_POINT"
#!/bin/bash
$PHP_BIN /usr/share/ncc/ncc --ncc-cli "\$@"
EOF
then
echo "Error: Failed to create entry point script at $ENTRY_POINT"
exit 1
fi
chmod +x "$ENTRY_POINT"
# Initialize ncc
if ! ncc setup --default-repositories=/usr/share/ncc/default_repositories.json; then
echo "Error: Failed to setup ncc"
exit 1
fi

21
src/debian/postrm Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
set -e
case "$1" in
remove|purge)
# Remove the entry point script
ENTRY_POINT="/usr/bin/ncc"
if [ -f "$ENTRY_POINT" ]; then
rm -f "$ENTRY_POINT"
echo "Removed $ENTRY_POINT"
else
echo "$ENTRY_POINT not found. Skipping removal."
fi
;;
*)
esac
# End of the script
exit 0