Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint the install script #36

Merged
merged 7 commits into from
Nov 28, 2023

Conversation

andrey-utkin
Copy link
Contributor

@andrey-utkin andrey-utkin commented Nov 23, 2023

Indented the main script uniformly, but leaving multi-line echo operators intact.
Added a test script running the interactive install process without user input.
Made some other minor changes.

Docker image is being pulled now, not built.
  $ shellcheck scripts/install.sh

 In scripts/install.sh line 10:
 [ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
   ^------^ SC2046 (warning): Quote this to prevent word splitting.

 In scripts/install.sh line 41:
     cp $workingpath/bluecherry-docker/mailenv-example $workingpath/bluecherry-docker/.mailenv
        ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
 						      ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

 Did you mean:
     cp "$workingpath"/bluecherry-docker/mailenv-example "$workingpath"/bluecherry-docker/.mailenv

 In scripts/install.sh line 53:
     echo "\n\n"
 	 ^----^ SC2028 (info): echo may not expand escape sequences. Use printf.

 In scripts/install.sh line 72:
     echo "\n\n******************************************************************\n\n"
 	 ^-- SC2028 (info): echo may not expand escape sequences. Use printf.

 In scripts/install.sh line 81:
     read timezoneset
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 85:
     read -p "Please provide a mysql admin password:" mysqladminpass
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 86:
     read -p "Please provide a mysql bluecherry password:" mysqlbluecherrypass
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 123:
 # run `id $(whoami)` to find the UID/GID of your user
       ^------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
 	  ^-------^ SC2046 (warning): Quote this to prevent word splitting.

 Did you mean:
 # run $(id $(whoami)) to find the UID/GID of your user

 In scripts/install.sh line 135:
     read -p "Please provide the SMTP server: " smtpserver
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 136:
     read -p "Please provide the SMTP username: " smtplogin
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 137:
     read -p "Please provide the SMTP password: " smtppassword
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 138:
     read -p "Please provide the SMTP port: " smtpport
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 151:
 " > $workingpath/bluecherry-docker/.mailenv
     ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

 Did you mean:
 " > "$workingpath"/bluecherry-docker/.mailenv

 In scripts/install.sh line 196:
     read -p "Please provide the IP address of the NFS server: " nfsserver
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 197:
     read -p "Please provide the NFS server export path: " nfsexport
     ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 212:
       type: "nfs"
 	     ^-^ SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?

 In scripts/install.sh line 213:
       o: "addr=$nfsserver,nolock,soft"
 	       ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

 Did you mean:
       o: "addr="$nfsserver",nolock,soft"

 In scripts/install.sh line 214:
       device: ":$nfsexport"
 		^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

 Did you mean:
       device: ":"$nfsexport""

 In scripts/install.sh line 215:
 " > $workingpath/bluecherry-docker/docker-compose.override.yml
     ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

 Did you mean:
 " > "$workingpath"/bluecherry-docker/docker-compose.override.yml

 In scripts/install.sh line 222:
     local directory=$pwd/bluecherry-docker
 		    ^--^ SC2154 (warning): pwd is referenced but not assigned (for output from commands, use "$(pwd ...)" ).

 In scripts/install.sh line 258:
 	"centos" | "rhel" | "fedora" | "rocky" | "Rocky")
 			    ^------^ SC2221 (warning): This pattern always overrides a later one on line 267.

 In scripts/install.sh line 267:
 	"fedora")
 	^------^ SC2222 (warning): This pattern never matches because of a previous pattern on line 258.

 In scripts/install.sh line 280:
 	. /etc/os-release
 	  ^-------------^ SC1091 (info): Not following: /etc/os-release was not specified as input (see shellcheck -x).

 In scripts/install.sh line 364:
 read -p "Do you want to install docker and setup Bluecherry server? [y/n]: " answer
 ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 381:
 read -p "Do you want to download and configure the Bluecherry docker images?  If this is the first run of the script then select 'y' [y/n]: " clonedocker
 ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 397:
 read -p "Do you want to configure SMTP settings? [y/n]: " smtp
 ^--^ SC2162 (info): read without -r will mangle backslashes.

 In scripts/install.sh line 413:
 read -p "Do you want to add a NFS mount? [y/n]: " add_nfs
 ^--^ SC2162 (info): read without -r will mangle backslashes.
Copy link
Member

@curtishall curtishall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested install script, worked fine under 22.04

Copy link
Member

@curtishall curtishall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested under Fedora 38.

Not important....but running the expect script under Fedora 38 failed due to output of installation files requiring additional confirmation

@curtishall curtishall merged commit 3779f6b into bluecherrydvr:master Nov 28, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants