Skip to content

Instantly share code, notes, and snippets.

@arturmartins
Created January 19, 2025 14:08
Show Gist options
  • Save arturmartins/5fd0eb7329c3b11ef9a6f09f85d6a9a6 to your computer and use it in GitHub Desktop.
Save arturmartins/5fd0eb7329c3b11ef9a6f09f85d6a9a6 to your computer and use it in GitHub Desktop.
Install lastpass for linux
#!/bin/bash
#
# Author: github.com/arturmartins
# Version: 1.0.0
# Config details can be found in https://lastpass.com/lplinux.php
# CONFIG: URL and filenames
TARBALL="lplinux.tar.bz2"
URL="https://download.cloud.lastpass.com/linux/${TARBALL}"
INSTALL_SCRIPT="install_lastpass.sh"
TEMP_DIR=$(mktemp -d)
# Expected SHA-256 checksum (2025-Jan-19)
EXPECTED_CHECKSUM="826e383a6bad905d942e22b14aee67dbc39e8f7a5243d706af787c8fcec6f158"
# FUNCTIONS -----------------------------------------------------
info_msg() {
echo "[INFO] $1"
}
download(){
# Download the file
info_msg "Downloading $TARBALL..."
wget -O $TARBALL $URL
# Calculate the SHA-256 checksum
info_msg "Verifying the checksum..."
CHECKSUM=$(sha256sum $TARBALL | awk '{ print $1 }')
# Compare the checksum
if [ "$CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
info_msg "Checksum verification failed! Exiting."
exit 1
fi
}
install(){
# Extract the tarball to the temporary directory
info_msg "Extracting $TARBALL to $TEMP_DIR..."
tar xjvf $TARBALL -C $TEMP_DIR
# Run the install script
info_msg "Running the install script..."
sudo $TEMP_DIR/$INSTALL_SCRIPT
# Delete the downloaded file
info_msg "Cleaning up..."
rm $TARBALL
rm -r $TEMP_DIR
}
# MAIN ---------------------------------------------------------
main(){
info_msg "Installing lastpass for Linux:"
download
install
info_msg "Installation complete!"
}
# start here
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment