(historical reference only) revision 20190308
-
Menu > Addons
- download list
addons-list.json
- download list
-
Addons page
- populate list and block
addons-list.json
>addons.php
- install/uninstall/update buttons status based on:
- current version vs installed version :
addons-list.json
vs/srv/http/data/addons/ADDON
- current version vs installed version :
- user input options
addons.js
- user input dialogs for options
- cancel any time by
X
button
- send script
- append options
addons.js
>addons-progress.php
- populate list and block
-
Addons Progress page
- prepare command and options
- get download url from
addons-list.json
- get download url from
- run script
addons.php
- line-by-line output of bash scripts on screen
ob_implicit_flush(); ob_end_flush();
- prepare command and options
install.sh
anduninstall_<alias>.sh
scripts- addon in
addonslist.php
bash scripts and files hosted on
https://github.com/RuneAddons/<addon_title>
trusted maintainers may host the scripts on their own repositorieshttps://github.com/<GitHubID>/<addon_title>
use script default### template
lines except non-install addons
default variables and functions will take care most of install activities
-
install script
- for update, get saved options as install parameters / arguments
- install required packages and verify
- install
.../archive/$branch.zip
files from repository withgetinstallzip
- extracted to respective directory of target root
- files in repository root will be removed
-
uninstall script
- restore everything to pre-install state
- restore files modified by provided edit commands with
restorefile FILE1 FILE2 ...
- restore files modified by provided edit commands with
- no need for non-install type
- file path:
- for install with
master.zip
- must be at
/usr/local/bin/
- must be at
- for install with individual downloads
- must be the same as
install.sh
to usegetuninstall
function - destination must be
/usr/local/bin/
- must be the same as
- for install with
- restore everything to pre-install state
-
update:
- will be done by uninstall > install
1.1 install.sh
template
#!/bin/bash
# main reference
alias=<alias>
### template - import default variables, functions
. /srv/http/addons.sh
. /srv/http/addonsedit.sh
### template - function: start message, installed check
installstart $@
### template - verify installed > download > install > verify install
if [[ $( pacman -Ss 'mainpackage$' | head -n1 | awk '{print $NF}' ) != '[installed]' ]]; then
pkgs='package package1 package2'
checklist='package package1 package2 depend other'
fallbackurl=https://path/to/single/tarball
installPackages "$pkgs" "$checklist" "$fallbackurl"
fi
### template - function: get repository zip and extract to system directories
getinstallzip
### template - function: (optional) rank miror servers and 'pacman -Sy' before install packages
rankmirrors
# start custom script ------------------------------------------------------------------------------>>>
echo -e "$bar Restore options ..."
if [[ $1 == u ]]; then
<option>=$( redis-cli get <option> ) # already no output - '&> /dev/null' with 'get's return null
redis-cli del <option> &> /dev/null # '&> /dev/null' for others to hide output
fi
echo -e "$bar <package> package ..."
pacman -S --noconfirm <packages>
echo -e "$bar Modify files ..."
file=/<path>/<file>
echo $file
if ! grep -q 'check string' $file; then
comment 'search'
string=$( cat <<'EOF'
place code inside this heredoc literally
last line
EOF
)
insert 'search'
fi
echo 'content' >> /<path>/<newfile>
# end custom script --------------------------------------------------------------------------------<<<
### template - function: save version to database, finish message
installfinish $@
# extra info if any
title -nt "extra info"
1.2 uninstall_<alias>.sh
template
#!/bin/bash
# main reference
alias=<alias>
### template - import default variables, functions
. /srv/http/addonstitle.sh
. /srv/http/addonsedit.sh
### template - function: start message, installed check
uninstallstart $@
# start custom script ------------------------------------------------------------------------------>>>
echo -e "$bar Save options ..."
if [[ $1 == u ]]; then
<value>=$( <get value1> )
redis-cli set <option> $<value> &> /dev/null
fi
echo -e "$bar Remove <package> ..."
pacman -R noconfirm <packages>
echo -e "$bar Remove files ..."
rm -v /<path>/<file>
echo -e "$bar Restore files ..."
file=/<path>/<file>
echo $file
mv -v /<path>/<file>{.backup,}
file=/<path>/<file>
echo $file
restorefile $file
# end custom script --------------------------------------------------------------------------------<<<
### template - function: remove version from database, finish message
uninstallfinish $@
insert / append / comment : for /*...*/ <?php /*...*/ ?> #...
====================================================================================
pre-defined variable:
------------------------------------------------------------------------------------
alias=name already in install.sh / uninstall_alias.sh
file=/path/file before all commands of each file
string=$( cat <<'EOF' before each insert and append
place code without escapes to use variable inside, unquote 'EOF' (literal $ must be escaped)
last line
EOF
)
usage:
------------------------------------------------------------------------------------
match [-n N] SEARCH [-n N] [SEARCH2] test sed search pattern
comment [-n N] SEARCH [-n N] [SEARCH2] /*alias js,php,css alias*/
commentH [-n N] SEARCH [-n N] [SEARCH2] <?php /*alias html,php alias*/ ?>
commentP [-n N] SEARCH [-n N] [SEARCH2]
commentS [-n N] SEARCH [-n N] [SEARCH2] #alias ...
insert [-n N] SEARCH //0alias0
append [-n N] SEARCH js,php,css
//1alias1
insertH [-n N] SEARCH <?php //0alias0 ?>
appendH [-n N] SEARCH html
<?php //1alias1 ?>
insertP [-n N] SEARCH <?php //0alias0
appendP [-n N] SEARCH php
<?php //1alias1
insertS [-n N] SEARCH #0alias0
appendS [-n N] SEARCH ...
#1alias1
insertAsset SEARCH FILE.ext <?php //0alias0 ?>
appendAsset SEARCH FILE.ext <style> @font-face { ... } </style>
<link rel="stylesheet" href="<?=$this->asset('/css/FILE.css')?>">
<script src="<?=$this->asset('/js/FILE.js')?>"></script>
<?php //1alias1 ?>
restorefile FILE [FILE2 ...] remove all insert / append / comment
argument:
------------------------------------------------------------------------------------
-n N -n -N N lines above SEARCH
-n +N N lines below SEARCH
SEARCH normal sed regex syntax inside quotes
'..."'"...' escape single quote inside itself
"...\"..." escape double quote inside itself
| as delimiter - no need to escape /
literal | ^ $ . * [ ] \ need \ escape
or use . as placeholder instead of escape
tips:
------------------------------------------------------------------------------------
test run SEARCH:
# . /srv/http/addonsedit.sh
# file=/path/file
# match [-n N] SEARCH [-n N] [SEARCH2]
cache busting - insert/append FILE.ttf/FILE.woff/FILE.css/FILE.js with insertAsset/appendAsset
insert/append with SEARCH itself in $string:
must be after comment to the same SEARCH (avoid commented after insert)
must be combined with insert/append to the same SEARCH (avoid double insert)
do not isert/append into another insert/append
it will be uninstalled with that addon
template
ALIAS: {
/**/ 'version' : 'YYYMMDD',
/**/ 'revision' : 'SUMMARY',
'title' : 'ADDON NAME',
'maintainer' : 'AUTHOR NAME',
'description' : 'DESCRIPTION',
'sourcecode' : 'https://github.com/RuneAddons/REPOSITORY',
'installurl' : 'https://github.com/RuneAddons/REPOSITORY/raw/master/install.sh',
/**/ 'thumbnail' : 'https://github.com/RuneAddons/REPOSITORY/image/FILENAME',
/**/ 'postinfo' : 'POST INSTALL MESSAGE',
/**/ 'buttonlabel' : 'LABEL',
/**/ 'nouninstall' : TRUE,
/**/ 'hide' : BOOLEAN,
/**/ 'verify' : {
'command' : 'COMMAND LINE'
'notverified' : 'MESSAGE'
}
/**/ 'option' : {
'wait' : 'MESSAGE',
'warning' : 'MESSAGE',
'confirm' : 'MESSAGE',
'skip' : 'MESSAGE',
'yesno' : {
'message' : 'MESSAGE',
/**/ 'mgsalign' : 'CSS',
/**/ 'cancellabel' : 'LABEL',
/**/ 'oklabel' : 'LABEL',
},
'text' : {
/**/ 'message' : 'MESSAGE',
'label' : 'LABEL',
/**/ 'boxwidth' : PIXEL,
/**/ 'required' : INDEX
},
'password' : {
/**/ 'message' : 'MESSAGE',
'label' : 'LABEL',
/**/ 'required' : TRUE,
},
'file' : {
/**/ 'message' : 'MESSAGE',
'label' : 'LABEL',
/**/ 'type' : 'FILETYPE'
},
'radio' : {
/**/ 'message' : 'MESSAGE',
'list' : {
'LABEL' : 'VALUE',
/**/ 'custom' : '?',
},
/**/ 'ckecked' : INDEX,
},
'select' : {
/**/ 'message' : 'MESSAGE',
/**/ 'label' : 'LABEL',
'list' : {
'LABEL' : 'VALUE',
/**/ 'custom' : '?',
},
/**/ 'ckecked' : INDEX
},
'checkbox' : {
/**/ 'message' : 'MESSAGE',
'list' : [
'LABEL' : 'VALUE',
},
/**/ 'ckecked' : INDEX
},
},
}
/**/
- optional
'sourcecode'
- 'blank' = no 'detail' link (only for built-in scripts)
'alias'
- should be 4 charaters
'version'
- buttons enable/disable
'version'
changed > showUpdate
button- non-install addons:
- omit >
Install
button always enable, noUninstall
button
- omit >
- run once addons:
- omit but
redis-cli hset addons <alias> 1
in install script >Install
button disable after run
- omit but
'buttonlabel'
- for non-install only
'Link'
- for information only (open'sourceurl'
)
'nouninstall'
- for non-uninstall addon
- hide
Uninstall
button
'hide'
- for compatability and redundant
'only03'
if for RuneAudio 0.3 only - omit for both versions compatible'installed'
if redundant addon already installed'exec'
if bash script result = true'php'
if php script result = true
'verify'
- for verification to continue
'command'
command to verify'notverified'
if result was false, show message and exit
'option'
- user inputs
- each
'key' : 'value'
open a dialog - each
'key'
will be appended asinstall.sh
arguments / parameters - options must be single quoted,
" 'key' : 'value' "
- dialog types:
'wait'
=Ok
Ok
= continue (no value)
'confirm'
=Cancel
Ok
Ok
= continue (no value) |Cancel
= cancel and back
'skip'
=No
Yes
Yes
= no more options |No
= continue options
'yesno'
=No
Yes
Yes
= 1 |No
= 0checked
= set primary button
'warning'
=Ok
(activated if not blank)Ok
= back
'text'
=<input type="text">
Ok
= inputrequired
= ok button disabled if required field blank
'password'
=<input type="password">
- input +
Ok
> verification +Ok
= input | blank +Ok
= 0 required
= ok button disabled if password blank
- input +
'file'
=<input type="file">
Ok
= uploadtype
filetype filter and verify
'radio'
=<input type="radio">
- single valueOk
= selected value | custom +Ok
>'text'
>Ok
= inputchecked
= default 0'?'
custom input marker
'select'
=<select><option>...
- single value, too long for'radio'
Ok
= selected value | custom +Ok
>'text'
>Ok
= inputchecked
= default 0'?'
custom input marker
'checkbox'
=<input type="checkbox">
- multiple valuesOk
= checked valueschecked
= default none
'radio'
,'select'
,'checkbox'
can be html instead- multiple tems of the same type must be array
- blank value get passed as a
''
arguement to bash X
- cancel and back to main page
styling for revision
, description
, option
- preset css:
<white>white text</white>
<code>code block</code>
- quotes in strings: (otherwise json errors)
- double quote:
\"
or"
="
- single quote:
'
='
(no\
escape for single quote)
- double quote:
- FontAwesome:
<i class=\"fa fa-<icon>\"></i>
(escape double quotes)
msgalign
:- none(
left
),center
,right
- none(
boxwidth
:- none(
medium
),Npx
,'max'
- none(
-
test scripts:
- get
install.sh
,uninstall_<alias>.sh
and files ready on yourhttps://github.com/<GitHubID>/<addon_title>
- open Addons Menu
- add addon to
/srv/http/addons-list.json
:- change values according to the template
- change
RuneAddons
to your<GitHubID>
- test url:
'installurl' : 'https://github.com/<GitHubID>/<addon_title>/raw/master/install.sh'
- test url:
- refresh browser to show the added addon (reopen will download and overwrite
addonslist.php
) - test install / uninstall scripts
- get
-
add a repository to
RuneAddons
:- a request to join with your
<GitHubID>
and'installurl'
- ---a new repository created as
https://github.com/RuneAddons/<addon_title>
- ---a
Branch
named your<GitHubID>
created - add scripts and files to the ropository
Pull request
- ---the
Branch
merged and ready for Addons Menu
- a request to join with your
-
add addon data to Addons Menu:
Fork
Addons Menu -https://github.com/rern/RuneAudio_Addons
- add addon to
/srv/http/addonslist.php
- change
<GitHubID>
toRuneAddons
- actual url:
'installurl' : 'https://github.com/RuneAddons/<addon_title>/raw/master/install.sh'
- actual url:
- change
Pull request
- ---the
Fork
merged and officially is online
- update the scripts and files in
RuneAddons
:- your
Branch
-https://github.com/RuneAddons/<addon_title>
- update / modify - test
Install
Uninstall
from branchUninstall
existing version- long-press
Install
button and type the branch name, your<GitHubID>
- test the updated addon functions
Uninstall
- test
Update
from branchInstall
existing version- long-press
Uninstall
button and type the branch name, your<GitHubID>
Pull request
- your
- update the list in Addons:
- test updating as a user
SSH
-/srv/http/addonslist.php
- edit addon- (next
Menu
>Addons
will overwrite this edit) - change
'version'
- enableUpdate
button - change
'revision'
- summary list of this update - refresh browser to show the changes
- long-press
Update
button
- your
Fork
-https://github.com/<GitHubID>/AddonsMenu
- copy the changes to.../srv/http/addonslist.php
Pull request
- test updating as a user
(Should not do unless necessary)
connection_status() !== 0
:
- Stop button
- Back button
- Close / Exit
Process:
- Running script killed
wget
killed and*.zip
deletedpacman
killed anddb.lck
lock file deleteduninstall_<alias>.sh
deleted