Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96ebe91

Browse files
D-BroxElsie190oAstro
authored
hotfix(1.6.1): Minor bug fixes (#315)
* Fix(install): build_depends removal * Fix(install): build_depends extra spaces and correct install * Fix(install): Wrong comparison I also moved the ppa thingy before all apt installs * Fix(install): if `$breaks` is equal to `$name` * Fix(install): postrm `ask` return code * Fix(install): build_depends auto removal * Fix(install): edit with elevated priviledges * Fix(download): reduce priviledges * Fix(install): reduce priviledges on the pacscript * Fix(install): breaks is a list * Fix(install): remove unused if * Fix(install): ignore pacstall installed dpkg-query * FIx(install): typos * FIx(install): `then` -> `do` * Bump version * feat(github): Move workflow script here (#316) * add(ci): workflow script * chan(ci): script link * chan(ci): script link * Update remote-bash.yml * fix(ci-script): rm axel * fix(ci): missing -y * Fix(ci): use install script * fix(ci): chown * Update workflow.sh * Update remote-bash.yml * Fix(install): codacy fix * Ref(CI):change branch Co-authored-by: The TwilightBlood <[email protected]> Co-authored-by: Naruto Uzumaki <[email protected]>
1 parent c87179a commit 96ebe91

5 files changed

Lines changed: 78 additions & 31 deletions

File tree

.github/workflows/remote-bash.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
with:
1010
args:
1111
env:
12-
REMOTE_BASH_URL: https://gist.githubusercontent.com/Henryws/d20ffad301c9f83f9c9f6243553c961a/raw/0ec81d2abc977f414ac03163ce7eed8e2bd43586/pacstall-install-and-install-something-long-file-name.sh
12+
REMOTE_BASH_URL: https://github.com/pacstall/pacstall/raw/develop/.github/workflows/workflow.sh

.github/workflows/workflow.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
apt install -y sudo bc wget iputils-ping network-manager
4+
echo "N" | sudo bash -c "$(curl -fsSL https://git.io/JsADh || wget -q https://git.io/JsADh -O -)"
5+
useradd -m -d /home/pacstall pacstall
6+
usermod -a -G sudo pacstall
7+
8+
# chowning
9+
LOGDIR="/var/log/pacstall/metadata"
10+
STGDIR="/usr/share/pacstall"
11+
SRCDIR="/tmp/pacstall"
12+
chown pacstall -R "$SRCDIR"
13+
chown pacstall -R "$LOGDIR"
14+
chown pacstall -R "/var/log/pacstall/error_log"
15+
export LOGNAME="pacstall"
16+
17+
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
18+
sudo -u pacstall bash -c : && RUNAS="sudo -u pacstall"
19+
20+
$RUNAS bash<<_
21+
export TERM="xterm"
22+
echo "Installing neofetch"
23+
pacstall -PI neofetch
24+
if [[ $? -ne 0 ]]; then
25+
echo "Something went wrong"
26+
exit 1
27+
fi
28+
echo "Installing deb package"
29+
pacstall -PI brave-browser-beta-deb
30+
if [[ $? -ne 0 ]]; then
31+
echo "Something went wrong"
32+
exit 1
33+
fi
34+
echo "Testing removal"
35+
pacstall -PR neofetch
36+
if [[ $? -ne 0 ]]; then
37+
echo "Something went wrong"
38+
exit 1
39+
fi
40+
_

misc/scripts/download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if curl --output /dev/null --silent --head --fail "$URL" ; then
4040

4141
case "$URL" in
4242
*.pacscript)
43-
sudo wget -q --show-progress --progress=bar:force "$URL" > /dev/null 2>&1
43+
wget -q --show-progress --progress=bar:force "$URL" > /dev/null 2>&1
4444
;;
4545
*)
4646
download "$URL" > /dev/null 2>&1

misc/scripts/install-local.sh

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ function ask() {
200200
reply=$default
201201
fi
202202
case "$reply" in
203-
Y*|y*) export answer=1;;
204-
N*|n*) export answer=0;;
203+
Y*|y*) export answer=1; return 0;;
204+
N*|n*) export answer=0; return 1;;
205205
esac
206206
}
207207
if [[ -z $PACSTALL_REMOVE ]] && [[ -z $PACSTALL_INSTALL ]]; then
@@ -290,19 +290,15 @@ if ! checks; then
290290
return 1
291291
fi
292292

293-
if [[ -n "$build_depends" ]]; then
294-
fancy_message info "${BLUE}$name${NC} requires ${CYAN}$(echo -e "$build_depends")${NC} to install"
295-
ask "Do you want to remove them after installing ${BLUE}$name${NC}" N
296-
if [[ $answer -eq 1 ]]; then
297-
NOBUILDDEP=0
298-
fi
299-
else
300-
NOBUILDDEP=1
301-
fi
302-
303293
# Trap Crtl+C just before the point cleanup is first needed
304294
trap "trap_ctrlc" 2
305295

296+
if [[ -n "$ppa" ]]; then
297+
for i in "${ppa[@]}"; do
298+
# Add ppa, but ppa bad I guess
299+
sudo add-apt-repository ppa:"$i"
300+
done
301+
fi
306302

307303
if [[ -n "$pacdeps" ]]; then
308304
for i in "${pacdeps[@]}"; do
@@ -319,25 +315,25 @@ if [[ -n "$pacdeps" ]]; then
319315
done
320316
fi
321317

322-
if echo -n "$depends" > /dev/null 2>&1; then
323-
if [[ -n "$breaks" ]]; then
324-
if dpkg-query -W -f='${Status}' "${breaks}" 2> /dev/null | grep "^install ok installed" > /dev/null 2>&1; then
318+
if [[ -n "$breaks" ]]; then
319+
for pkg in $breaks; do
320+
if dpkg-query -W -f='${Status} ${Section}' "${pkg}" 2> /dev/null | grep "^install ok installed" | grep -v "Pacstall" > /dev/null 2>&1; then
325321
# Check if anything in breaks variable is installed already
326-
fancy_message error "${RED}$name${NC} breaks $breaks, which is currently installed by apt"
322+
fancy_message error "${RED}$name${NC} breaks $pkg, which is currently installed by apt"
327323
error_log 13 "install $PACKAGE"
328324
fancy_message info "Cleaning up"
329325
cleanup
330326
return 1
331327
fi
332-
if [[ $(pacstall -L) == $breaks ]]; then
328+
if [[ "${pkg}" != "${name}" ]] && pacstall -L | grep "${pkg}" > /dev/null 2>&1; then
333329
# Same thing, but check if anything is installed with pacstall
334-
fancy_message error "${RED}$name${NC} breaks $breaks, which is currently installed by pacstall"
330+
fancy_message error "${RED}$name${NC} breaks $pkg, which is currently installed by pacstall"
335331
error_log 13 "install $PACKAGE"
336332
fancy_message info "Cleaning up"
337333
cleanup
338334
return 1
339335
fi
340-
fi
336+
done
341337
fi
342338

343339
if [[ -n $replace ]]; then
@@ -353,14 +349,25 @@ if [[ -n $replace ]]; then
353349
fi
354350
fi
355351

356-
if [[ -n "$ppa" ]]; then
357-
for i in "${ppa[@]}"; do
358-
# Add ppa, but ppa bad I guess
359-
sudo add-apt-repository ppa:"$i"
360-
done
361-
fi
352+
# Get all uninstalled build depends
353+
for build_dep in $build_depends; do
354+
if dpkg-query -W -f='${Status}' "${build_dep}" 2> /dev/null | grep "^install ok installed" > /dev/null 2>&1; then
355+
build_depends=${build_depends/"${build_dep}"/};
356+
fi;
357+
done
358+
359+
build_depends=$(echo "$build_depends" | tr -s ' ' | awk '{gsub(/^ +| +$/,"")} {print $0}')
360+
361+
# This echo makes it ignore empty strigs
362+
if [[ -n "$build_depends" ]]; then
363+
fancy_message info "${BLUE}$name${NC} requires ${CYAN}$(echo -e "$build_depends")${NC} to install"
364+
ask "Do you want to remove them after installing ${BLUE}$name${NC}" N
365+
if [[ $answer -eq 0 ]]; then
366+
NOBUILDDEP=0
367+
else
368+
NOBUILDDEP=1
369+
fi
362370

363-
if [[ $NOBUILDDEP -eq 0 ]]; then
364371
if ! sudo apt-get install -y -qq -o=Dpkg::Use-Pty=0 $build_depends; then
365372
fancy_message error "Failed to install build dependencies"
366373
error_log 8 "install $PACKAGE"
@@ -527,8 +534,8 @@ if ! install; then
527534
exit 1
528535
fi
529536

530-
if [[ $REMOVE_DEPENDS = y ]]; then
531-
sudo apt-get remove $build_depends
537+
if [[ $NOBUILDDEP -eq 1 ]]; then
538+
sudo apt-get remove -y "$build_depends"
532539
fi
533540

534541
cd "$HOME" 2> /dev/null || ( error_log 1 "install $PACKAGE"; fancy_message warn "Could not enter into ${HOME}" )

pacstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ while [[ ! "$1" == "--" ]]; do
442442
PACKAGE="$2"
443443

444444
if [[ -z "$PACKAGE" ]]; then
445-
echo -e "1.6 ${BICyan}Celadon${NC}"
445+
echo -e "1.6.1 ${BIPurple}Cerise${NC}"
446446
exit 0
447447
else
448448
# If pacstall -V was called with an argument, it's a package, so get the package version (usful for scripting)

0 commit comments

Comments
 (0)