mirror of
https://github.com/antos-rde/antos.git
synced 2025-07-13 14:14:29 +02:00
feat: Support CI and cross compile for amd64, arm64, arm
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
This commit is contained in:
69
scripts/ckarch.sh
Executable file
69
scripts/ckarch.sh
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TARGET=$1
|
||||
|
||||
[[ -z "$TARGET" ]] && echo "No taget provided" && exit 1
|
||||
[[ ! -d "$TARGET" ]] && echo "Target is not a directory" && exit 1
|
||||
|
||||
DIRS=$(ls "$TARGET")
|
||||
EXIT_CODE=0
|
||||
|
||||
BLUE="\e[1;34m"
|
||||
NC="\e[0m"
|
||||
CERR="\e[1;31m"
|
||||
COK="\e[1;32m"
|
||||
GRAY="\e[90m"
|
||||
YELLOW="\e[93m"
|
||||
|
||||
check_file() {
|
||||
FILE=$1
|
||||
LD=$2
|
||||
echo -n -e "${YELLOW}Checking $FILE:....................${NC}"
|
||||
if ! file "$(realpath "$FILE")" | grep "$LD" > /dev/null ; then
|
||||
echo -e "${CERR}FAILED${NC}"
|
||||
EXIT_CODE=1
|
||||
echo -e -n "${GRAY}"
|
||||
file "$(realpath "$FILE")"
|
||||
echo -e "${NC}"
|
||||
else
|
||||
echo -e "${COK}OK${NC}"
|
||||
echo -e -n "${GRAY}"
|
||||
readelf -d "$FILE" | grep NEEDED || true
|
||||
echo -e "${NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
check() {
|
||||
ARCH=$1
|
||||
LD=$2
|
||||
ROOT=$TARGET/$ARCH/opt/www
|
||||
echo -e "${BLUE}Checking: $TARGET/$ARCH${NC}"
|
||||
# check bin directory
|
||||
for file in "$ROOT"/bin/*; do
|
||||
check_file "$file" "$LD"
|
||||
done
|
||||
# check for libraries
|
||||
libs=$(find "$ROOT"/lib/ -name "*.so*")
|
||||
for lib in $libs; do
|
||||
check_file "$lib" "$LD"
|
||||
done
|
||||
}
|
||||
|
||||
for dir in $DIRS; do
|
||||
case $dir in
|
||||
arm64)
|
||||
check "$dir" "ARM aarch64"
|
||||
;;
|
||||
arm)
|
||||
check "$dir" "ARM, EABI"
|
||||
;;
|
||||
amd64)
|
||||
check "$dir" "x86-64"
|
||||
;;
|
||||
*)
|
||||
echo "Unkown architecture: $dir, ignore it"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
exit $EXIT_CODE
|
@ -6,25 +6,22 @@ arch=$1
|
||||
tag=$2
|
||||
DIR=$3
|
||||
logo=$4
|
||||
[ -z $arch ] && echo "1. No architecture provided" && exit 1
|
||||
[ -z $tag ] && echo "2. No version provided" && exit 1
|
||||
[ -z $DIR ] && echo "3. No input dir provided" && exit 1
|
||||
[ -z $logo ] && echo "4. No logo file provided" && exit 1
|
||||
[ -z "$arch" ] && echo "1. No architecture provided" && exit 1
|
||||
[ -z "$tag" ] && echo "2. No version provided" && exit 1
|
||||
[ -z "$DIR" ] && echo "3. No input dir provided" && exit 1
|
||||
[ -z "$logo" ] && echo "4. No logo file provided" && exit 1
|
||||
# download the appimagetools
|
||||
echo "Downloading the appimage tools"
|
||||
archname=x86_64
|
||||
case $arch in
|
||||
amd64|x86_64)
|
||||
archname=x86_64
|
||||
suffix=x86_64
|
||||
;;
|
||||
aarch64|arm64)
|
||||
archname=aarch64
|
||||
suffix=aarch64
|
||||
;;
|
||||
armv7l|arm)
|
||||
archname=armhf
|
||||
suffix=armv7l
|
||||
;;
|
||||
*)
|
||||
echo "Unkown architecture"
|
||||
@ -46,7 +43,7 @@ echo "Building app image for $arch"
|
||||
|
||||
mkdir -p "$APP_DIR"
|
||||
|
||||
cp -rf $DIR/opt "$APP_DIR"
|
||||
cp -rf "$DIR/opt" "$APP_DIR"
|
||||
rm -rf $APP_DIR/opt/www/include || true
|
||||
rm -rf $APP_DIR/opt/www/etc/* || true
|
||||
|
||||
@ -186,6 +183,6 @@ Categories=Utility;
|
||||
Terminal=true
|
||||
EOF
|
||||
|
||||
cp $logo $APP_DIR/antos.png
|
||||
cp "$logo" "$APP_DIR/antos.png"
|
||||
|
||||
$APP_IMG --runtime-file $APP_RUNT $APP_DIR $DIR/$NAME.AppImage
|
||||
$APP_IMG --runtime-file $APP_RUNT $APP_DIR "$DIR/$NAME.AppImage"
|
@ -42,23 +42,23 @@ NAME="AntOS_${TAG}_${archname}"
|
||||
FILE="$NAME.deb"
|
||||
TMP="/tmp/$NAME"
|
||||
[ -d "$TMP" ] && rm -rf "$TMP"
|
||||
mkdir -p $TMP
|
||||
mkdir -p "$TMP"
|
||||
|
||||
echo "Copying binaries of version $TAG, architecture $ARCH to $TMP"
|
||||
cp $DIR/opt $TMP/ -rf
|
||||
cd $TMP
|
||||
cp "$DIR/opt" "$TMP/" -rf
|
||||
cd "$TMP"
|
||||
mkdir DEBIAN
|
||||
|
||||
cat << EOF >> DEBIAN/control
|
||||
Package: AntOS
|
||||
Version: $TAG
|
||||
Architecture: $archname
|
||||
Depends: libsqlite3-0,zlib1g,libreadline8,libssl1.1,libvncclient1,libjpeg-turbo8 | libturbojpeg0
|
||||
Maintainer: Dany LE <mrsang@iohub.dev>
|
||||
Description: All-in-one AntOS remote web-based desktop environment
|
||||
Depends: libsqlite3-0,zlib1g,libreadline8,libssl3,libvncclient1,libjpeg-turbo8 | libturbojpeg0 | libjpeg62-turbo
|
||||
Maintainer: Dany LE <dany@iohub.dev>
|
||||
Description: All-in-one AntOS web-based remote desktop environment
|
||||
EOF
|
||||
cat DEBIAN/control
|
||||
cd ..
|
||||
dpkg-deb --build $TMP
|
||||
dpkg-deb --build "$TMP"
|
||||
mv "$FILE" "$DIR/"
|
||||
|
||||
|
Reference in New Issue
Block a user