File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,11 +78,29 @@ a11y_scan() {
7878 $BINARY_PATH a11y $EXTRA_ARGS
7979}
8080
81+ script_self_update () {
82+ local remote_url=" https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/bash/cli.sh"
83+ local checksum_url=" ${remote_url} .sha256"
84+
85+ local updated_script
86+ updated_script=$( curl -sfSL " $remote_url " ) || return 0
87+ local expected_hash
88+ expected_hash=$( curl -sfSL " $checksum_url " | awk ' {print $1}' ) || return 0
89+
90+ local actual_hash
91+ actual_hash=$( printf ' %s' " $updated_script " | shasum -a 256 | awk ' {print $1}' )
92+
93+ if [[ -n " $expected_hash " ]] && [[ " $actual_hash " == " $expected_hash " ]] && [[ $updated_script =~ ^#! ]]; then
94+ echo " $updated_script " > " $SCRIPT_PATH "
95+ fi
96+ }
97+
8198download_binary () {
8299 curl -R -z " $BINARY_ZIP_PATH " -L " http://api.browserstack.com/sdk/v1/download_cli?os=${OS} &os_arch=${ARCH} " -o " $BINARY_ZIP_PATH "
83100 bsdtar -xvf " $BINARY_ZIP_PATH " -O > " $BINARY_PATH " && chmod 0775 " $BINARY_PATH "
84101}
85102
103+ script_self_update
86104if [[ $SUBCOMMAND == " register-pre-commit-hook" ]]; then
87105 register_git_hook
88106 exit 0
Original file line number Diff line number Diff line change @@ -90,11 +90,29 @@ a11y_scan() {
9090 $BINARY_PATH a11y $EXTRA_ARGS
9191}
9292
93+ script_self_update () {
94+ local remote_url=" https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/fish/cli.sh"
95+ local checksum_url=" ${remote_url} .sha256"
96+
97+ local updated_script
98+ updated_script=$( curl -sfSL " $remote_url " ) || return 0
99+ local expected_hash
100+ expected_hash=$( curl -sfSL " $checksum_url " | awk ' {print $1}' ) || return 0
101+
102+ local actual_hash
103+ actual_hash=$( printf ' %s' " $updated_script " | shasum -a 256 | awk ' {print $1}' )
104+
105+ if [[ -n " $expected_hash " ]] && [[ " $actual_hash " == " $expected_hash " ]] && [[ $updated_script =~ ^#! ]]; then
106+ echo " $updated_script " > " $SCRIPT_PATH "
107+ fi
108+ }
109+
93110download_binary () {
94111 curl -R -z " $BINARY_ZIP_PATH " -L " http://api.browserstack.com/sdk/v1/download_cli?os=${OS} &os_arch=${ARCH} " -o " $BINARY_ZIP_PATH "
95112 bsdtar -xvf " $BINARY_ZIP_PATH " -O > " $BINARY_PATH " && chmod 0775 " $BINARY_PATH "
96113}
97114
115+ script_self_update
98116if [[ $SUBCOMMAND == " register-pre-commit-hook" ]]; then
99117 register_git_hook
100118 exit 0
Original file line number Diff line number Diff line change @@ -89,11 +89,29 @@ a11y_scan() {
8989 $BINARY_PATH a11y $EXTRA_ARGS
9090}
9191
92+ script_self_update () {
93+ local remote_url=" https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/zsh/cli.sh"
94+ local checksum_url=" ${remote_url} .sha256"
95+
96+ local updated_script
97+ updated_script=$( curl -sfSL " $remote_url " ) || return 0
98+ local expected_hash
99+ expected_hash=$( curl -sfSL " $checksum_url " | awk ' {print $1}' ) || return 0
100+
101+ local actual_hash
102+ actual_hash=$( printf ' %s' " $updated_script " | shasum -a 256 | awk ' {print $1}' )
103+
104+ if [[ -n " $expected_hash " ]] && [[ " $actual_hash " == " $expected_hash " ]] && [[ $updated_script =~ ^#! ]]; then
105+ echo " $updated_script " > " $SCRIPT_PATH "
106+ fi
107+ }
108+
92109download_binary () {
93110 curl -R -z " $BINARY_ZIP_PATH " -L " http://api.browserstack.com/sdk/v1/download_cli?os=${OS} &os_arch=${ARCH} " -o " $BINARY_ZIP_PATH "
94111 bsdtar -xvf " $BINARY_ZIP_PATH " -O > " $BINARY_PATH " && chmod 0775 " $BINARY_PATH "
95112}
96113
114+ script_self_update
97115if [[ $SUBCOMMAND == " register-pre-commit-hook" ]]; then
98116 register_git_hook
99117 exit 0
You can’t perform that action at this time.
0 commit comments