Skip to content

Commit

Permalink
List available software ID's.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Knight committed Apr 16, 2019
1 parent f139ad1 commit 91e3949
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -3068,10 +3068,10 @@ _EOF_
# Download_Install 'https://file.com/file' /etc/install_here
# dps_index=$software_id Download_Install 'conf_0' /etc/conf.conf
# Optional input variables:
# fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390
# fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390
# no_check_url=[01] = Optionally disable URL check
# dps_index=$software_id = Download from DietPi GitHub repo based on software ID/index
# DEPS_LIST='pkg1 ...' = Install APT dependency packages
# DEPS_LIST='pkg1 ...' = Install APT dependency packages
# NB: This does not support installs that require user input (eg: a whiptail prompt for deb installs)
Download_Install(){

Expand Down Expand Up @@ -15160,7 +15160,7 @@ _EOF_
#List unique software names and ID's
elif [[ $1 == 'list' ]]; then

for i in ${!aSOFTWARE_INSTALL_STATE[@]}
for (( i=0; i<${#aSOFTWARE_INSTALL_STATE[@]}; i++))

This comment has been minimized.

Copy link
@MichaIng

MichaIng Apr 16, 2019

Owner

@Fourdee
This does not work, since unused indices are not pre-generated, so ${#aSOFTWARE_INSTALL_STATE[@]} does not match the highest index.

I will create a separate command argument: free

This comment has been minimized.

Copy link
@MichaIng

MichaIng Apr 17, 2019

Owner

Done:

root@VM-Stretch:~# dietpi-software free
[  OK  ] DietPi-Software | Root access verified.
[  OK  ] DietPi-Software | RootFS R/W access verified.
[  OK  ] DietPi-Software | Initialized database
[  OK  ] DietPi-Software | Reading database
Free software ID(s): None, so use 176!

Hacking free indices inside:

root@VM-Stretch:~# dietpi-software free
[  OK  ] DietPi-Software | Root access verified.
[  OK  ] DietPi-Software | RootFS R/W access verified.
[  OK  ] DietPi-Software | Initialized database
[  OK  ] DietPi-Software | Reading database
Free software ID(s): 33 34 119

This comment has been minimized.

Copy link
@Fourdee

Fourdee Apr 20, 2019

Collaborator

@MichaIng

Legend (fixing my broken code again) 👍 🤣

Thank you!

This comment has been minimized.

Copy link
@MichaIng

MichaIng Apr 20, 2019

Owner

@Fourdee
Related to my change to skip array pre-generation some time ago. It increased loading speed but the downside is that some values need to be pre-generated e.g. when checked in arithmetic (( ${aARRAY[$i]:=0} ... and yeah empty array indices bring other limitations as well 🙈.

do

local string=''
Expand All @@ -15169,6 +15169,10 @@ _EOF_

string="\e[32mID $i | "

elif [[ ! ${aSOFTWARE_WHIP_NAME[$i]} ]]; then

string="\e[91mID $i | DEV USE: AVAILABLE SOFTWARE ID $i"

else

string="\e[0mID $i | "
Expand Down

0 comments on commit 91e3949

Please sign in to comment.