Skip to content

Commit 31fe789

Browse files
authored
Merge pull request #780 from ivan-hc/dev
Update install.am: DIY AppImage, look for deps only in the builder
2 parents a396652 + 3f64b90 commit 31fe789

File tree

20 files changed

+164
-280
lines changed

20 files changed

+164
-280
lines changed

APP-MANAGER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
AMVERSION="7.1"
3+
AMVERSION="7.1.1"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"

appimage-bulder-scripts/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ Try not to use [Archimage](https://github.com/ivan-hc/ArchImage), as build times
1717
If your AppImage creation script requires specific dependencies, please let me know with a PR.
1818

1919
TIP, creating AppImage on the fly can take time and resources, depending on the complexity of the program being compiled. It is highly suggested to publish the AppImages to a repository, using Github Actions, [as I do](https://github.com/ivan-hc#my-appimage-packages).
20+
21+
### Syntax
22+
try to use key commands at the beginning of the line, to allow the "install.am" module to determine whether a command not installed on the system is required by the Appimage assembly script. Fore example:
23+
```
24+
tar fx ...
25+
ar x ...
26+
```
27+
to detect if "`tar`" and "`ar`" (from `binutils`) are needed.

modules/files.am

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@
66

77
_files_header() {
88
echo ""
9-
echo $(echo "- YOU HAVE INSTALLED "
10-
find "$APPSPATH" -type f -name 'remove' 2>/dev/null | sed -r 's|/[^/]+$||' | sort | uniq | wc -l
9+
APPSNUMB=$(find "$APPSPATH" -type f -name 'remove' -exec grep -L 'usr/local/lib' {} \; 2>/dev/null | sed -r 's|/[^/]+$||' | sort | uniq | wc -l)
10+
if [ "$APPSNUMB" = 1 ]; then
11+
APPSMESSAGE="YOU HAVE INSTALLED $APPSNUMB PROGRAM"
12+
else
13+
APPSMESSAGE="YOU HAVE INSTALLED $APPSNUMB PROGRAMS"
14+
fi
1115
if grep -q 'usr/local/lib' $APPSPATH/*/remove 2> /dev/null; then
12-
echo " STANDALONE PROGRAMS AND LIBRARIES MANAGED BY '$(echo $AMCLI | tr a-z A-Z)':"
16+
LIBNUMB=$(grep -l "usr/local/lib" "$APPSPATH"/*/remove | wc -l)
17+
if [ "$LIBNUMB" = 1 ]; then
18+
LIBSMESSAGE="AND $LIBNUMB LIBRARY"
19+
else
20+
LIBSMESSAGE="AND $LIBNUMB LIBRARIES"
21+
fi
22+
echo "- $APPSMESSAGE $LIBSMESSAGE MANAGED BY $(echo "\"$AMCLI\"" | tr a-z A-Z)"
1323
else
14-
echo " STANDALONE PROGRAMS MANAGED BY '$(echo $AMCLI | tr a-z A-Z)':"
15-
fi)
24+
echo "- $APPSMESSAGE MANAGED BY $(echo "\"$AMCLI\"" | tr a-z A-Z)"
25+
fi
1626
echo ""
1727
}
1828

modules/install.am

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,37 @@ function _install_arg() {
158158
echo -e " ⚠️ WARNING: \"$arg\" may not be updatable without \"zsync\".\n\n The app will still be installed, but installing \"zsync\" is recommended! \n"
159159
fi
160160
fi
161-
elif grep -q 'appimage-bulder-scripts' ./"$arg"; then
162-
appimage_build_deps="ar convert glib-compile-schemas tar unzip"
163-
for name in $appimage_build_deps; do
164-
if ! command -v "$name" &>/dev/null; then
165-
if [ "$name" == "ar" ]; then
166-
echo " 💀 ERROR: cannot create \"$arg\" without \"binutils\""; return 0
167-
elif [ "$name" == "convert" ]; then
168-
echo " 💀 ERROR: cannot create \"$arg\" without \"$name\" (from \"imagemagick\")"; return 0
169-
else
170-
echo " 💀 ERROR: cannot create \"$arg\" without \"$name\""; return 0
161+
elif grep -qi "^wget.*.sh.*chmod.*&&" ./"$arg"; then
162+
appimage_bulder_script=$(grep "^wget " ./"$arg" | tr '"' '\n' | grep -i "^http" | sed 's/$APP/'"$arg"'/g')
163+
if curl --output /dev/null --silent --head --fail "$appimage_bulder_script" 1>/dev/null; then
164+
appimage_build_deps="ar gcc glib-compile-schemas make tar unzip"
165+
for name in $appimage_build_deps; do
166+
if curl -Ls "$appimage_bulder_script" | grep "^$name" 1>/dev/null; then
167+
if ! command -v "$name" &>/dev/null; then
168+
if [ "$name" == "ar" ]; then
169+
echo " 💀 ERROR: cannot create \"$arg\" without \"binutils\""; return 0
170+
else
171+
echo " 💀 ERROR: cannot create \"$arg\" without \"$name\""; return 0
172+
fi
173+
fi
174+
fi
175+
done
176+
if curl -Ls "$appimage_bulder_script" | grep -i "appimagetool" 1>/dev/null; then
177+
if ! command -v convert &>/dev/null; then
178+
echo " 💀 ERROR: cannot create \"$arg\" without \"convert\" (from \"imagemagick\")"; return 0
179+
fi
180+
elif curl -Ls "$appimage_bulder_script" | grep -i "pkg2appimage" 1>/dev/null; then
181+
if ! command -v convert &>/dev/null; then
182+
echo " 💀 ERROR: cannot create \"$arg\" without \"convert\" (from \"imagemagick\")"; return 0
171183
fi
172184
fi
173-
done
185+
else
186+
echo " 💀 ERROR: cannot create \"$arg\", the builder does not exists"; return 0
187+
fi
174188
fi
175189
# Check if you are installing an app or a library
176190
echo -e "$(echo "\"$arg\"" | tr '[:lower:]' '[:upper:]'): starting installation script"
177-
if grep -q 'appimage-bulder-scripts' ./"$arg"; then
191+
if grep -qi "^wget.*.sh.*chmod.*&&" ./"$arg"; then
178192
echo -e "\n This script will create an AppImage on the fly, please wait..."
179193
elif grep -q "/usr/local/lib" ./"$arg"; then
180194
echo -e '\n ⚠️ This script installs a system library in /usr/local/lib, cancel it if:\n'

programs/aarch64/libfuse2

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,20 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
LIB=libfuse2
44
ARCH=$(uname -m)
55

6-
# CREATE THE FOLDER
7-
mkdir /opt/$LIB
8-
cd /opt/$LIB
9-
10-
# ADD THE REMOVER
11-
echo '#!/bin/sh
12-
sudo rm -R -f /opt/'$LIB' /usr/local/lib/libfuse*' >> /opt/$LIB/remove
13-
chmod a+x /opt/$LIB/remove
14-
15-
# DOWNLOAD THE ARCHIVE
16-
mkdir tmp
17-
cd ./tmp
18-
19-
function _debian_dl(){
20-
LIBFUSE2_DEB=$(curl -Ls http://ftp.debian.org/debian/pool/main/f/fuse/ | grep -Po '(?<=href=")[^"]*' | sort | grep -v exp | grep arm64 | grep "libfuse2_" | tail -1)
21-
wget http://ftp.debian.org/debian/pool/main/f/fuse/"$LIBFUSE2_DEB"
22-
ar x ./*.deb
23-
tar fx ./data.tar.xz
24-
cd ..
25-
sudo mkdir -p /usr/local/lib
26-
sudo mv ./tmp/lib/*/libfuse* /usr/local/lib/
27-
}
28-
29-
function _archlinux_dl(){
30-
wget https://archlinux.org/packages/extra/${ARCH}/fuse2/download && mv ./download ./$LIB.tar.zst
31-
tar fx ./*.tar.zst
32-
cd ..
33-
sudo mkdir -p /usr/local/lib
34-
sudo mv ./tmp/usr/lib/libfuse*2* /usr/local/lib/
35-
}
36-
37-
_debian_dl
38-
39-
#_archlinux_dl
40-
41-
rm -R -f ./tmp
42-
sudo ldconfig
6+
# CREATE DIRECTORIES AND ADD REMOVER
7+
[ -n "$LIB" ] && mkdir -p "/opt/$LIB/tmp" && cd "/opt/$LIB/tmp" || exit 1
8+
printf "#!/bin/sh\nset -e\nsudo rm -f /usr/local/lib/libfuse*\nrm -R -f /opt/$LIB" > ../remove
9+
chmod a+x ../remove || exit 1
10+
11+
# DOWNLOAD AND PREPARE THE LIBRARY
12+
LIBFUSE2_DEB=$(curl -Ls http://ftp.debian.org/debian/pool/main/f/fuse/ | grep -Po '(?<=href=")[^"]*' | sort | grep -v exp | grep arm64 | grep "libfuse2_" | tail -1)
13+
wget http://ftp.debian.org/debian/pool/main/f/fuse/"$LIBFUSE2_DEB" || exit 1
14+
ar x ./*.deb && tar fx ./data.tar.xz || exit 1
15+
cd .. || exit 1
16+
sudo mkdir -p /usr/local/lib || exit 1
17+
sudo mv ./tmp/lib/*/libfuse* /usr/local/lib/ && rm -R -f ./tmp || exit 1
18+
19+
# CONFIGURE DYNAMIC LINKER RUN-TIME BINDINGS
20+
sudo ldconfig

programs/i686/libfuse2

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,20 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
LIB=libfuse2
44
ARCH=$(uname -m)
55

6-
# CREATE THE FOLDER
7-
mkdir /opt/$LIB
8-
cd /opt/$LIB
9-
10-
# ADD THE REMOVER
11-
echo '#!/bin/sh
12-
sudo rm -R -f /opt/'$LIB' /usr/local/lib/libfuse*' >> /opt/$LIB/remove
13-
chmod a+x /opt/$LIB/remove
14-
15-
# DOWNLOAD THE ARCHIVE
16-
mkdir tmp
17-
cd ./tmp
18-
19-
function _debian_dl(){
20-
LIBFUSE2_DEB=$(curl -Ls http://ftp.debian.org/debian/pool/main/f/fuse/ | grep -Po '(?<=href=")[^"]*' | sort | grep -v exp | grep i386 | grep "libfuse2_" | tail -1)
21-
wget http://ftp.debian.org/debian/pool/main/f/fuse/"$LIBFUSE2_DEB"
22-
ar x ./*.deb
23-
tar fx ./data.tar.xz
24-
cd ..
25-
sudo mkdir -p /usr/local/lib
26-
sudo mv ./tmp/lib/*/libfuse* /usr/local/lib/
27-
}
28-
29-
function _archlinux_dl(){
30-
wget https://archlinux.org/packages/extra/${ARCH}/fuse2/download && mv ./download ./$LIB.tar.zst
31-
tar fx ./*.tar.zst
32-
cd ..
33-
sudo mkdir -p /usr/local/lib
34-
sudo mv ./tmp/usr/lib/libfuse*2* /usr/local/lib/
35-
}
36-
37-
_debian_dl
38-
39-
#_archlinux_dl
40-
41-
rm -R -f ./tmp
42-
sudo ldconfig
6+
# CREATE DIRECTORIES AND ADD REMOVER
7+
[ -n "$LIB" ] && mkdir -p "/opt/$LIB/tmp" && cd "/opt/$LIB/tmp" || exit 1
8+
printf "#!/bin/sh\nset -e\nsudo rm -f /usr/local/lib/libfuse*\nrm -R -f /opt/$LIB" > ../remove
9+
chmod a+x ../remove || exit 1
10+
11+
# DOWNLOAD AND PREPARE THE LIBRARY
12+
LIBFUSE2_DEB=$(curl -Ls http://ftp.debian.org/debian/pool/main/f/fuse/ | grep -Po '(?<=href=")[^"]*' | sort | grep -v exp | grep i386 | grep "libfuse2_" | tail -1)
13+
wget http://ftp.debian.org/debian/pool/main/f/fuse/"$LIBFUSE2_DEB" || exit 1
14+
ar x ./*.deb && tar fx ./data.tar.xz || exit 1
15+
cd .. || exit 1
16+
sudo mkdir -p /usr/local/lib || exit 1
17+
sudo mv ./tmp/lib/*/libfuse* /usr/local/lib/ && rm -R -f ./tmp || exit 1
18+
19+
# CONFIGURE DYNAMIC LINKER RUN-TIME BINDINGS
20+
sudo ldconfig

programs/x86_64/ffwa-facebook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
APP=ffwa-facebook
44
APPNAME="Facebook"

programs/x86_64/ffwa-github

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
APP=ffwa-github
44
APPNAME="GitHub"

programs/x86_64/ffwa-gmail

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
APP=ffwa-gmail
44
APPNAME="Gmail"

programs/x86_64/ffwa-netflix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

33
APP=ffwa-netflix
44
APPNAME="Netflix"

0 commit comments

Comments
 (0)