-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathNEW-junest.sh
More file actions
137 lines (102 loc) · 6.27 KB
/
NEW-junest.sh
File metadata and controls
137 lines (102 loc) · 6.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
APP=SAMPLE
BIN="$APP" #CHANGE THIS IF THE NAME OF THE BINARY IS DIFFERENT FROM "$APP" (for example, the binary of "obs-studio" is "obs")
DEPENDENCES="" #SYNTAX: "APP1 APP2 APP3 APP4...", LEAVE BLANK IF NO OTHER DEPENDENCIES ARE NEEDED
#BASICSTUFF="binutils debugedit gzip"
#COMPILERS="base-devel"
# Set keywords to searchan include in names of directories and files in /usr/bin (BINSAVED), /usr/share (SHARESAVED) and /usr/lib (LIBSAVED)
BINSAVED="SAVEBINSPLEASE"
SHARESAVED="SAVESHAREPLEASE"
LIBSAVED="SAVELIBSPLEASE"
# Set the items you want to manually REMOVE. Complete the path in /etc/, /usr/bin/, /usr/lib/, /usr/lib/python*/ and /usr/share/ respectively.
# The "rm" command will take into account the listed object/path and add an asterisk at the end, completing the path to be removed.
# Some keywords and paths are already set. Remove them if you consider them necessary for the AppImage to function properly.
ETC_REMOVED="makepkg.conf pacman"
BIN_REMOVED="gcc"
LIB_REMOVED="gcc"
PYTHON_REMOVED="__pycache__/"
SHARE_REMOVED="gcc icons/AdwaitaLegacy icons/Adwaita/cursors/ terminfo"
# Set mountpoints, they are ment to be set into the AppRun.
# Default mounted files are /etc/resolv.conf, /etc/hosts, /etc/nsswitch.conf, /etc/passwd, /etc/group, /etc/machine-id, /etc/asound.conf and /etc/localtime
# Default mounted directories are /media, /mnt, /opt, /run/media, /usr/lib/locale, /usr/share/fonts, /usr/share/themes, /var, and Nvidia-related directories
# Do not touch this if you are not sure.
mountpoint_files=""
mountpoint_dirs=""
# Post-installation processes (add whatever you want)
_post_installation_processes() {
printf "\n◆ User's processes: \n\n"
echo " - None"
# Add here your code
}
##########################################################################################################################################################
# SETUP THE ENVIRONMENT
##########################################################################################################################################################
# Download archimage-builder.sh
if [ ! -f ./archimage-builder.sh ]; then
ARCHIMAGE_BUILDER="https://raw.githubusercontent.com/ivan-hc/ArchImage/refs/heads/main/core/archimage-builder.sh"
wget --retry-connrefused --tries=30 "$ARCHIMAGE_BUILDER" -O ./archimage-builder.sh || exit 0
fi
# Create and enter the AppDir
mkdir -p AppDir archlinux && cd archlinux || exit 1
_JUNEST_CMD() {
./.local/share/junest/bin/junest "$@"
}
# Set archlinux as a temporary $HOME directory
HOME="$(dirname "$(readlink -f "$0")")"
##########################################################################################################################################################
# DOWNLOAD, INSTALL AND CONFIGURE JUNEST
##########################################################################################################################################################
_enable_archlinuxcn() { ARCHLINUXCN_ON="1"; }
_enable_chaoticaur() { CHAOTICAUR_ON="1"; }
_enable_multilib() { MULTILIB_ON="1"; }
#_enable_archlinuxcn
#_enable_chaoticaur
#_enable_multilib
[ -f ../archimage-builder.sh ] && source ../archimage-builder.sh junest-setup "$@"
##########################################################################################################################################################
# INSTALL PROGRAMS USING YAY
##########################################################################################################################################################
[ -f ../archimage-builder.sh ] && source ../archimage-builder.sh install "$@"
cd ..
##########################################################################################################################################################
# APPDIR
##########################################################################################################################################################
[ -f ./archimage-builder.sh ] && source ./archimage-builder.sh appdir "$@"
##########################################################################################################################################################
# APPRUN
##########################################################################################################################################################
rm -f AppDir/AppRun
# Set to "1" if you want to add Nvidia drivers manager in the AppRun
export NVIDIA_ON=0
[ -f ./archimage-builder.sh ] && source ./archimage-builder.sh apprun "$@"
# AppRun footer, here you can add options and change the way the AppImage interacts with its internal structure
cat <<-'HEREDOC' >> AppDir/AppRun
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g')
if ! echo "$EXEC" | grep -q "/usr/bin"; then EXEC="/usr/bin/$EXEC"; fi
_JUNEST_CMD -- $EXEC "$@"
HEREDOC
chmod a+x AppDir/AppRun
##########################################################################################################################################################
# COMPILE
##########################################################################################################################################################
[ -f ./archimage-builder.sh ] && source ./archimage-builder.sh compile "$@"
##########################################################################################################################################################
# CREATE THE APPIMAGE
##########################################################################################################################################################
if test -f ./*.AppImage; then rm -Rf ./*archimage*.AppImage; fi
APPNAME=$(cat AppDir/*.desktop | grep '^Name=' | head -1 | cut -c 6- | sed 's/ /-/g')
REPO="$APPNAME-appimage"
TAG="latest"
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|$REPO|$TAG|*x86_64.AppImage.zsync"
echo "$VERSION" > ./version
_appimagetool() {
if ! command -v appimagetool 1>/dev/null; then
if [ ! -f ./appimagetool ]; then
echo " Downloading appimagetool..." && curl -#Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-"$ARCH".AppImage && chmod a+x ./appimagetool || exit 1
fi
./appimagetool "$@"
else
appimagetool "$@"
fi
}
ARCH=x86_64 _appimagetool -u "$UPINFO" AppDir "$APPNAME"_"$VERSION"-"$ARCHIMAGE_VERSION"-x86_64.AppImage