Skip to content

Sedbatch shell script

Poutnik edited this page Aug 28, 2019 · 2 revisions

In progress....

Ver 1.1 Fixed generation for Hiking-wet profiles ( by error identical to dry ones ) Ver 1.2 Parameter "main" generates only main/major profiles Ver 1.2.1 Fixed names of Trekking-Dry/Wet profiles ( Was Poutnik instead of Trekking ]) Ver 1.3.1 Added Shortest-P profile Ver 1.3.2 windows batch ported to Linux Bash Ver 1.4 Improved script parameter logic. Action paramaters are bike/car/foot, modifiers are master/develop and all/main Implemented termux path specifics and profike copying Ver 1.5 Umplemented modifiers local/git/remote Umplemented modifiers copy/nocopy

automatically generates a bunch of Brouter profiles based on the bike/car/foot profile templates by Poutnik

When launched, 1/ it create a working subfolder in a folder where the script resides 2/ it downloads latest bike/car/foot profile template from GitHub depository 3/ it generates end user profiles by automatic subtitution of parameters 4/ it packs them into a single ZIP archive and deletes the working subfolder content. 5/ it optionally copies profiles to the scriot folder or from termux private space to Android storage.


                 P R E R E Q U I S I T I E S

0 This bash script can be run either on a desktop Linux either on Android within Linux terminal emulator termux.

Points 1-5 applies only if to be run on an Android device

1 Install termux ( Linux terminal emulator for Android ) https://play.google.com/store/apps/details?id=com.termux Read links below for more https://termux.com https://wiki.termux.com/wiki/Main_Page https://wiki.termux.com/wiki/Community https://github.com/termux

2 Run termux, what open Linux terminal emulator

3 Execute "termux-setup-storage" if you want to grant termux permissions to write profile files out of its sandbox to be able to copy profiles to Android storage. It is recommendec not to copy directly to live profiles2 folder. (run "apt update && apt upgrade" to make sure that this tool is available) See more at https://wiki.termux.com/wiki/Termux-setup-storage

4 Check if sed, wget and git commands are available. If not, install them by "pkg install sed" resp. "pkg install wget" or "pkg install git" ( sed in termux and sed + wget in lLinux will be probably installed by default ).

5 Check and define withing the script code your desired target folder for copying profiles.

6 If run on termux with jailbreak ( having access to android storage ) the zipped profiles will be copied to the folder provided withing the script.

7 Both Linux and termux expects placing the sedbatch script (subject of later renaming, remsins for historical reasons )

8 If git/pull modifiers are to be used, one must clone respective git repositories into the single master repository folder.

9
The sedbatch script expects particular command line parameters to do anything. "sedbatch" without parameters lists this legend. "sedbatch" can be provided by arbitrary sequence of keywords: bike car foot ( mtb street ) main all master develop copy nocopy remote local git

bike, car, foot(, mtb, street) are "action" keywords, generating respective profiles from a profile template.

all(default), main are modifiers, setting scope of generated profiles ( all or the most important) master(default), develop are modifiers determining the github repository branch, where the profile template is located ( if git modifier is used, they preform switching local git branches ) nocopy(default), copy, copies profiles to Android storage ( with jailbroken termux ) remote(default), git, local determined location of the script template ( local=script folder, git=local git repository, remote=remote github repository)

Examples of usage' "sedbatch bike" generates all profiles from bike trekking template and stores them in BR-Bike-Profiles-master-all.zip and generates the all profiles for all car, bike and foot transportation modes

"sedbatch main develop bike" generates only selected major profiles from bike trekking template from develop branch

"sedbatch copy main foot all bike develop main car" generates major profiles for hiking, all profiles for bike trekking and selected profiles from car template develop branch. Additionally, profiles are copied to selected folder


                 L E G E N D

echo 'The sedbatch script expects an arbitrary sequence of following keywords to do anything:' echo 'bike car foot main all master develop copy nocopy local remote git'
echo '.' echo 'bike, car, foot are "action" keywords, generating respective profiles from a profile template' echo '.' echo 'all(default), main set the scope of generated profiles ( all or the most important)' echo 'master(default), develop are modifiers determining the github repository branch, where the profile template is located' echo '.' echo 'If a modifier is used it becomes the new default' echo 'for the rest of the line, unless overridden again.' echo '.' echo 'for examples and more info, see the legend comments withing the script.'

}

Clone this wiki locally