Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes running am -i on a local script fails the first time #653

Closed
Samueru-sama opened this issue Jun 11, 2024 · 19 comments · Fixed by #793
Closed

Sometimes running am -i on a local script fails the first time #653

Samueru-sama opened this issue Jun 11, 2024 · 19 comments · Fixed by #793

Comments

@Samueru-sama
Copy link
Contributor

Hey, this is an issue that I've noticed has been happening ever since I made the mpv appimage:

image

Sometimes am tires to pull from the database instead of using the script I'm telling it use, if I didn't rename the script to have the .sh at the end of the name, it would have used the existing cpu-x script on the database instead of the local one that I'm telling it to use.

(am is appman btw).

@Samueru-sama
Copy link
Contributor Author

@ivan-hc I'm testing cpu-x again because the dev said to have fixed the issue, but it doesn't look like it works 😭

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 11, 2024

have you tried to use the whole path?

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 11, 2024

I'm testing this ar appman in normal mode, no issue here

Istantanea_2024-06-11_17-05-15 png

@Samueru-sama
Copy link
Contributor Author

I'm testing this ar appman in normal mode, no issue here

Istantanea_2024-06-11_17-05-15 png

The issue happens when I give it a relative path instead of a full path:

image

But it only happens the first time after I give it the ./cpu-x.sh the second time it does pick up the file.

(btw that ln error in the screenshot is because I removed the cpu-x directory instead of running am -r)

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 11, 2024

what if you name it cpu-x instead of cpu-x.sh?

@Samueru-sama
Copy link
Contributor Author

what if you name it cpu-x instead of cpu-x.sh?

It will pull the cpu-x script from the database instead of using the local one.

This is why I ran into this issue with mpv back then: #605

The icons dir wasn't being created because it was pulling the script with the issue from the database instead of using the local one that already had the mkdir /opt/"$APP"/icons

@Samueru-sama
Copy link
Contributor Author

How does am -i know when to use a local file vs pulling from the repo?

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 11, 2024

			# Various cases that may occur during installation (for example if you use a third-party repository)
			if test -f $APPSPATH/$arg/remove; then
				echo " ◆ $(echo '"'$arg'"' | tr a-z A-Z): app already installed previously! Try removing it."
			else
				if test -f ./$arg 2> /dev/null; then
					mkdir -p "$AMCACHEDIR"/tmp; cp ./$arg "$AMCACHEDIR"/tmp/$arg; cd "$AMCACHEDIR" || return; mv ./tmp/$arg ./$arg; rmdir ./tmp
					_install_arg
				elif test -f $arg 2> /dev/null; then
					path2arg=$(echo "$arg")
					arg=$(echo "$path2arg" | sed 's:.*/::')
					cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; cp $path2arg ./$arg; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
					_install_arg
				elif test -f "$AMPATH/neodb"; then
					rm -R -f "$AMCACHEDIR/multirepo-args"
					MULTIREPO=$(cat "$AMPATH/neodb" | grep "Source=" | sed 's/Source=//g')
					for anyrepo in $MULTIREPO; do
						if curl --output /dev/null --silent --head --fail $anyrepo/$arg  1>/dev/null; then
							echo "$anyrepo" >> "$AMCACHEDIR/multirepo-args"
						fi
					done
					if test -f "$AMCACHEDIR/multirepo-args"; then
						anyrepoargs=$(cat "$AMCACHEDIR/multirepo-args" 2>/dev/null | wc -l)
						if [ $anyrepoargs -gt 0 ]; then
							if curl --output /dev/null --silent --head --fail $APPSDB/$arg  1>/dev/null; then
								echo "$APPSDB" >> "$AMCACHEDIR/multirepo-args"
							fi
							anyrepoargall=$(cat "$AMCACHEDIR/multirepo-args" 2>/dev/null | wc -l)
							if [ $anyrepoargall == 1 ]; then
								cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; wget -q "$(cat "$AMCACHEDIR/multirepo-args" | head -1)/$arg"; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
								rm -R -f "$AMCACHEDIR/multirepo-args"
								_install_arg
							else
								echo -e "\n ◆ FOUND $(echo '"'$arg'"' | tr a-z A-Z) FROM MULTIPLE SOURCES:\n" &&
								printf " Select a URL from this menu (read carefully) or press CTRL+C to abort:\n\n"; sleep 1;
								select d in $(cat "$AMCACHEDIR/multirepo-args"); do test -n "$d" && break; echo ">>> Invalid Selection"; done
								cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; wget -q "$d/$arg"; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
								rm -R -f "$AMCACHEDIR/multirepo-args"
								_install_arg
							fi
						elif curl --output /dev/null --silent --head --fail $APPSDB/$arg  1>/dev/null; then
							cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; wget -q $APPSDB/$arg; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
							rm -R -f "$AMCACHEDIR/multirepo-args"
							_install_arg
						else
							echo ' 💀 ERROR: "'$arg'" does NOT exist in the database, see "'$AMCLI' -l"'
						fi
					elif curl --output /dev/null --silent --head --fail $APPSDB/$arg  1>/dev/null; then
						cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; wget -q $APPSDB/$arg; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
						_install_arg
					else
						echo ' 💀 ERROR: "'$arg'" does NOT exist in the database, see "'$AMCLI' -l"'
					fi
				elif curl --output /dev/null --silent --head --fail $APPSDB/$arg  1>/dev/null; then
					cd "$AMCACHEDIR" || return; mkdir -p tmp; cd tmp || return; wget -q $APPSDB/$arg; cd ..; mv ./tmp/$arg ./$arg; rmdir ./tmp
					_install_arg
				else
					echo ' 💀 ERROR: "'$arg'" does NOT exist in the database, see "'$AMCLI' -l"'
				fi
			fi

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 11, 2024

it should work exactly as first choice

			# Various cases that may occur during installation (for example if you use a third-party repository)
			if test -f $APPSPATH/$arg/remove; then
				echo " ◆ $(echo '"'$arg'"' | tr a-z A-Z): app already installed previously! Try removing it."
			else
				if test -f ./$arg 2> /dev/null; then
					mkdir -p "$AMCACHEDIR"/tmp; cp ./$arg "$AMCACHEDIR"/tmp/$arg; cd "$AMCACHEDIR" || return; mv ./tmp/$arg ./$arg; rmdir ./tmp
					_install_arg

@Samueru-sama
Copy link
Contributor Author

I really don't know why this happens then:

image

I thought that the issue was that I was using ./cpu-x.sh and am interpreted that as ././cpu-x.sh so I tested just putting cpu-x.sh without the ./ and it still fails the first time for some reason.

@Samueru-sama
Copy link
Contributor Author

Alright I began testing all the releases from the last 2 weeks.

So I removed appman and replaced it for version 6.7 and up.

After I did this the issue no longer happens, even with the latest version 💀 so likely I fucked some module, or something got borked when appman updated back then.

I'll be closing this, hopefully the issue doesn't show up again.

@Samueru-sama
Copy link
Contributor Author

Reopening this.

I took this screenshot when I was editing the brave scripts:

bug

@Samueru-sama Samueru-sama reopened this Jul 6, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Jul 6, 2024

brave? were they not ok?

@Samueru-sama
Copy link
Contributor Author

It happens with any script:

image

I add the .sh because otherwise am will pull the existing script instead of the local one.

@ivan-hc
Copy link
Owner

ivan-hc commented Jul 16, 2024

I cannot reproduce the issue... also I see that "AM" suggests appman -l, so I supposed you were working in AppMan Mode... but I can't see the message

This is ./adb.sh installed with normal AM

Istantanea_2024-07-16_17-00-24

and this is AM in AppMan mode

Istantanea_2024-07-16_17-00-56

I've no ideaon why this happens to you.

@ivan-hc
Copy link
Owner

ivan-hc commented Jul 17, 2024

I'm not sure on why all tests in the PR are a failure, however to drag/drop the script always works in this case.

I think I give up this time.

@Samueru-sama
Copy link
Contributor Author

Thats ok, I will have a look at how the whole install module works

@ivan-hc
Copy link
Owner

ivan-hc commented Jul 17, 2024

if not to solve this issue, function will help to understand more how this module works.

@ivan-hc
Copy link
Owner

ivan-hc commented Jul 17, 2024

@Samueru-sama a tip: since the module uses the "select" command, SHELL have not an alternative for that.

This is why this, but also the script to install "wine" are BASH scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants