awless: remove empty cheat sheet, update the update section
[webi-installers/.git] / chromedriver / install.sh
1 #!/bin/bash
2
3 {
4     set -e
5     set -u
6
7     ########################
8     # Install chromedriver #
9     ########################
10
11     # Every package should define these 6 variables
12     pkg_cmd_name="chromedriver"
13
14     pkg_dst_cmd="$HOME/.local/bin/chromedriver"
15     pkg_dst="$pkg_dst_cmd"
16
17     pkg_src_cmd="$HOME/.local/opt/chromedriver-v$WEBI_VERSION/bin/chromedriver"
18     pkg_src_dir="$HOME/.local/opt/chromedriver-v$WEBI_VERSION"
19     pkg_src="$pkg_src_cmd"
20
21     # pkg_install must be defined by every package
22     pkg_install() {
23         # ~/.local/opt/chromedriver-v88.0.4324.96/bin
24         mkdir -p "$(dirname $pkg_src_cmd)"
25
26         # mv ./chromedriver-*/chromedriver ~/.local/opt/chromedriver-v88.0.4324.96/bin/chromedriver
27         mv ./chromedriver* "$pkg_src_cmd"
28     }
29
30     # pkg_get_current_version is recommended, but (soon) not required
31     pkg_get_current_version() {
32         # 'chromedriver --version' has output in this format:
33         #       ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784})
34         # This trims it down to just the version number:
35         #       88.0.4324.96
36         echo $(chromedriver --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
37     }
38
39 }