-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d01b70a
commit 5e3e629
Showing
4 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
|
||
#-------------------------------------------------------# | ||
#Sanity Checks | ||
if [ "$BUILD" != "YES" ] || \ | ||
[ -z "$BINDIR" ] || \ | ||
[ -z "$EGET_EXCLUDE" ] || \ | ||
[ -z "$EGET_TIMEOUT" ] || \ | ||
[ -z "$GIT_TERMINAL_PROMPT" ] || \ | ||
[ -z "$GIT_ASKPASS" ] || \ | ||
[ -z "$GITHUB_TOKEN" ] || \ | ||
[ -z "$SYSTMP" ] || \ | ||
[ -z "$TMPDIRS" ]; then | ||
#exit | ||
echo -e "\n[+]Skipping Builds...\n" | ||
exit 1 | ||
fi | ||
#-------------------------------------------------------# | ||
|
||
#-------------------------------------------------------# | ||
##Main | ||
export SKIP_BUILD="NO" #YES, in case of deleted repos, broken builds etc | ||
if [ "$SKIP_BUILD" == "NO" ]; then | ||
#lorien : An infinite canvas drawing/note-taking app | ||
export BIN="lorien" | ||
export SOURCE_URL="https://github.com/mbrlabs/Lorien" | ||
echo -e "\n\n [+] (Building | Fetching) $BIN :: $SOURCE_URL\n" | ||
##Build | ||
pushd "$($TMPDIRS)" >/dev/null 2>&1 | ||
NIXPKGS_ALLOW_UNFREE="1" nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#lorien" --log-format bar-with-logs --impure | ||
##Copy | ||
sudo rsync -av --copy-links "./lorien.AppImage" "./lorien.AppImage.tmp" | ||
sudo chown -R "$(whoami):$(whoami)" "./lorien.AppImage.tmp" && chmod -R 755 "./lorien.AppImage.tmp" | ||
du -sh "./lorien.AppImage.tmp" && file "./lorien.AppImage.tmp" | ||
##Extract | ||
APPIMAGE="$(realpath .)/lorien.AppImage.tmp" && export APPIMAGE="${APPIMAGE}" | ||
OFFSET="$(${APPIMAGE} --appimage-offset)" && export OFFSET="${OFFSET}" | ||
tail -c +"$(($OFFSET + 1))" "${APPIMAGE}" > "./squash.tmp" | ||
#unsquashfs -force -dest "./squash_tmp/" "./squash.tmp" | ||
"${APPIMAGE}" --appimage-extract >/dev/null && rm -f "${APPIMAGE}" | ||
OWD="$(realpath .)" && export OWD="${OWD}" | ||
APPIMAGE_EXTRACT="$(realpath "./squashfs-root")" && export APPIMAGE_EXTRACT="${APPIMAGE_EXTRACT}" | ||
##Patch | ||
if [ -d "${APPIMAGE_EXTRACT}" ] && [ "$(find "${APPIMAGE_EXTRACT}" -mindepth 1 -print -quit 2>/dev/null)" ]; then | ||
#Media | ||
cd "${APPIMAGE_EXTRACT}" | ||
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo" | ||
SHARE_DIR="$(find "." -path '*share/*lorien*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}" | ||
#usr/{applications,bash-completion,icons,metainfo,lorien,zsh} | ||
rsync -av --copy-links \ | ||
--include="*/" \ | ||
--include="*.desktop" \ | ||
--include="*.png" \ | ||
--include="*.svg" \ | ||
--include="*.xml" \ | ||
--exclude="*" \ | ||
"${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/" | ||
##Appdata/AppStream | ||
# find "." -path '*share/*lorien*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./usr/share/metainfo/"' ; cp "./usr/share/metainfo/lorien.metainfo.xml" "./usr/share/metainfo/lorien.appdata.xml" | ||
#Icon | ||
find "." -path '*/*lorien*.png' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp "{}" ./lorien.png' | ||
find "." -maxdepth 1 -type f -name '*.svg' -exec sh -c 'convert "$0" "${0%.svg}.png"' {} \; 2>/dev/null | ||
cp "./lorien.png" "./.DirIcon" | ||
##Desktop | ||
find "." -path '*lorien*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./lorien.desktop"' | ||
sed 's/Icon=[^ ]*/Icon=lorien/' -i "./lorien.desktop" 2>/dev/null | ||
#(Re)Pack | ||
cd "${OWD}" | ||
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "./appimagetool" && chmod +x "./appimagetool" | ||
ARCH="$(uname -m)" "./appimagetool" --comp "zstd" \ | ||
--mksquashfs-opt -root-owned \ | ||
--mksquashfs-opt -no-xattrs \ | ||
--mksquashfs-opt -noappend \ | ||
--mksquashfs-opt -b --mksquashfs-opt "1M" \ | ||
--mksquashfs-opt -mkfs-time --mksquashfs-opt "0" \ | ||
--mksquashfs-opt -Xcompression-level --mksquashfs-opt "22" \ | ||
"${APPIMAGE_EXTRACT}" "$BINDIR/lorien.AppImage" | ||
#Meta | ||
du -sh "$BINDIR/lorien.AppImage" && file "$BINDIR/lorien.AppImage" | ||
#clean | ||
unset APPIMAGE APPIMAGE_EXTRACT OFFSET OWD SHARE_DIR | ||
fi | ||
#End | ||
nix-collect-garbage >/dev/null 2>&1 ; popd >/dev/null 2>&1 | ||
fi | ||
#-------------------------------------------------------# | ||
|
||
#-------------------------------------------------------# | ||
##Cleanup | ||
unset SKIP_BUILD ; export BUILT="YES" | ||
#In case of zig polluted env | ||
unset AR CC CFLAGS CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LDFLAGS LIBS OBJCOPY RANLIB | ||
#In case of go polluted env | ||
unset GOARCH GOOS CGO_ENABLED CGO_CFLAGS | ||
#PKG Config | ||
unset PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH | ||
#-------------------------------------------------------# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "lorien" | ||
description: "An infinite canvas drawing/note-taking app (AppImage)" | ||
web_url: "https://github.com/mbrlabs/Lorien" | ||
repo_url: "https://github.com/mbrlabs/Lorien" | ||
path: "/" | ||
bins: | ||
- "lorien.AppImage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
|
||
#-------------------------------------------------------# | ||
#Sanity Checks | ||
if [ "$BUILD" != "YES" ] || \ | ||
[ -z "$BINDIR" ] || \ | ||
[ -z "$EGET_EXCLUDE" ] || \ | ||
[ -z "$EGET_TIMEOUT" ] || \ | ||
[ -z "$GIT_TERMINAL_PROMPT" ] || \ | ||
[ -z "$GIT_ASKPASS" ] || \ | ||
[ -z "$GITHUB_TOKEN" ] || \ | ||
[ -z "$SYSTMP" ] || \ | ||
[ -z "$TMPDIRS" ]; then | ||
#exit | ||
echo -e "\n[+]Skipping Builds...\n" | ||
exit 1 | ||
fi | ||
#-------------------------------------------------------# | ||
|
||
#-------------------------------------------------------# | ||
##Main | ||
export SKIP_BUILD="NO" #YES, in case of deleted repos, broken builds etc | ||
if [ "$SKIP_BUILD" == "NO" ]; then | ||
#lorien : An infinite canvas drawing/note-taking app | ||
export BIN="lorien" | ||
export SOURCE_URL="https://github.com/mbrlabs/Lorien" | ||
echo -e "\n\n [+] (Building | Fetching) $BIN :: $SOURCE_URL\n" | ||
##Build | ||
pushd "$($TMPDIRS)" >/dev/null 2>&1 | ||
NIXPKGS_ALLOW_UNFREE="1" nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#lorien" --log-format bar-with-logs --impure | ||
##Copy | ||
sudo rsync -av --copy-links "./lorien.AppImage" "./lorien.AppImage.tmp" | ||
sudo chown -R "$(whoami):$(whoami)" "./lorien.AppImage.tmp" && chmod -R 755 "./lorien.AppImage.tmp" | ||
du -sh "./lorien.AppImage.tmp" && file "./lorien.AppImage.tmp" | ||
##Extract | ||
APPIMAGE="$(realpath .)/lorien.AppImage.tmp" && export APPIMAGE="${APPIMAGE}" | ||
OFFSET="$(${APPIMAGE} --appimage-offset)" && export OFFSET="${OFFSET}" | ||
tail -c +"$(($OFFSET + 1))" "${APPIMAGE}" > "./squash.tmp" | ||
#unsquashfs -force -dest "./squash_tmp/" "./squash.tmp" | ||
"${APPIMAGE}" --appimage-extract >/dev/null && rm -f "${APPIMAGE}" | ||
OWD="$(realpath .)" && export OWD="${OWD}" | ||
APPIMAGE_EXTRACT="$(realpath "./squashfs-root")" && export APPIMAGE_EXTRACT="${APPIMAGE_EXTRACT}" | ||
##Patch | ||
if [ -d "${APPIMAGE_EXTRACT}" ] && [ "$(find "${APPIMAGE_EXTRACT}" -mindepth 1 -print -quit 2>/dev/null)" ]; then | ||
#Media | ||
cd "${APPIMAGE_EXTRACT}" | ||
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo" | ||
SHARE_DIR="$(find "." -path '*share/*lorien*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}" | ||
#usr/{applications,bash-completion,icons,metainfo,lorien,zsh} | ||
rsync -av --copy-links \ | ||
--include="*/" \ | ||
--include="*.desktop" \ | ||
--include="*.png" \ | ||
--include="*.svg" \ | ||
--include="*.xml" \ | ||
--exclude="*" \ | ||
"${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/" | ||
##Appdata/AppStream | ||
# find "." -path '*share/*lorien*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./usr/share/metainfo/"' ; cp "./usr/share/metainfo/lorien.metainfo.xml" "./usr/share/metainfo/lorien.appdata.xml" | ||
#Icon | ||
find "." -path '*/*lorien*.png' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp "{}" ./lorien.png' | ||
find "." -maxdepth 1 -type f -name '*.svg' -exec sh -c 'convert "$0" "${0%.svg}.png"' {} \; 2>/dev/null | ||
cp "./lorien.png" "./.DirIcon" | ||
##Desktop | ||
find "." -path '*lorien*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./lorien.desktop"' | ||
sed 's/Icon=[^ ]*/Icon=lorien/' -i "./lorien.desktop" 2>/dev/null | ||
#(Re)Pack | ||
cd "${OWD}" | ||
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "./appimagetool" && chmod +x "./appimagetool" | ||
ARCH="$(uname -m)" "./appimagetool" --comp "zstd" \ | ||
--mksquashfs-opt -root-owned \ | ||
--mksquashfs-opt -no-xattrs \ | ||
--mksquashfs-opt -noappend \ | ||
--mksquashfs-opt -b --mksquashfs-opt "1M" \ | ||
--mksquashfs-opt -mkfs-time --mksquashfs-opt "0" \ | ||
--mksquashfs-opt -Xcompression-level --mksquashfs-opt "22" \ | ||
"${APPIMAGE_EXTRACT}" "$BINDIR/lorien.AppImage" | ||
#Meta | ||
du -sh "$BINDIR/lorien.AppImage" && file "$BINDIR/lorien.AppImage" | ||
#clean | ||
unset APPIMAGE APPIMAGE_EXTRACT OFFSET OWD SHARE_DIR | ||
fi | ||
#End | ||
nix-collect-garbage >/dev/null 2>&1 ; popd >/dev/null 2>&1 | ||
fi | ||
#-------------------------------------------------------# | ||
|
||
#-------------------------------------------------------# | ||
##Cleanup | ||
unset SKIP_BUILD ; export BUILT="YES" | ||
#In case of zig polluted env | ||
unset AR CC CFLAGS CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LDFLAGS LIBS OBJCOPY RANLIB | ||
#In case of go polluted env | ||
unset GOARCH GOOS CGO_ENABLED CGO_CFLAGS | ||
#PKG Config | ||
unset PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH | ||
#-------------------------------------------------------# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "lorien" | ||
description: "An infinite canvas drawing/note-taking app (AppImage)" | ||
web_url: "https://github.com/mbrlabs/Lorien" | ||
repo_url: "https://github.com/mbrlabs/Lorien" | ||
path: "/" | ||
bins: | ||
- "lorien.AppImage" |