Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
snwh committed May 20, 2018
1 parent 53a52e7 commit 0179189
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
19 changes: 10 additions & 9 deletions functions/check_functions
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
# Check if single package is installed
function check_package() {
# echo_message header "Starting 'check_package' function"
dpkg-query -W --showformat='${Status}\n' $1 | grep "install ok installed" &> /dev/null
# if not installed
if [ $? = 1 ]; then
# if package is not installed
if [ $(dpkg-query -W --showformat='${Status}\n' $1 | grep "install ok installed" &> /dev/null; echo $?) = 1 ]; then
# draw window
if (whiptail \
--title "Install ${1}" \
Expand All @@ -30,10 +29,8 @@ function check_package() {
# Check for Flatpak repository
function check_flatpak_repo {
# echo_message header "Starting 'check_flatpak_repo' function"
# Check if already added
flatpak remotes | grep $1 &> /dev/null
# If repo is added
if [ $? = 1 ]; then
# If repo not is added
if [ $(flatpak remotes | grep $1 &> /dev/null; echo $?) = 1 ]; then
# draw window
if (whiptail \
--title "Add ${1} Repository" \
Expand Down Expand Up @@ -71,23 +68,27 @@ function check_os {

# Check which distribution the user is running
function check_distribution {
EXITSTATUS=$(which lsb_release &>/dev/null; echo $?)
if [[ $EXITSTATUS != 0 ]]; then
# check if 'lsb_release' exists
if [[ $(which lsb_release &>/dev/null; echo $?) != 0 ]]; then
echo_message error "\aCan't check which distribution you are using! Aborting."
echo_message error " Aborting..." && sleep 3 && exit 99
else
# if Ubuntu
if lsb_release -ds | grep -qE '(Ubuntu)'; then
echo 'Current distribution is: '$(lsb_release -ds)
echo_message success "You are using Ubuntu. :D"
echo "Proceeding."
# if Mint or elementary
elif lsb_release -ds | grep -qE '(Mint|elementary)'; then
echo 'Current distribution is: '$(lsb_release -ds)
echo_message success "You are using an Ubuntu-based distribution. It's probably fine. :)"
echo "Proceeding."
# if Debian
elif lsb_release -ds | grep -q 'Debian'; then
echo 'Current distribution is: '$(lsb_release -ds)
echo_message warning "You are using Debian. This is not recommended. Some functions may not work. :/"
echo "Proceeding nonetheless."
# if anything else
else
echo_message warning "You are using a distribution that may not be compatible with this script set."
echo_message warning "Proceeding may break your system."
Expand Down
2 changes: 1 addition & 1 deletion functions/system_cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function purge_unused {
# Remove loop
for PACKAGE in $(cat $LIST); do
# If package is not installed
if [ $(dpkgkg-query -W --showformat='${Status}\n' $PACKAGE | grep "install ok installed" &> /dev/null; echo $?) = 1 ]; then
if [ $(dpkg-query -W --showformat='${Status}\n' $PACKAGE | grep "install ok installed" &> /dev/null; echo $?) = 1 ]; then
# Show already removed message
echo_message info "Package '$PACKAGE' already removed."
else
Expand Down
4 changes: 2 additions & 2 deletions ubuntu-post-install-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ function import_functions {
done
}

# Welcome message
echo_message welcome "$TITLE"
# Import main functions
import_functions
# Welcome message
echo_message welcome "$TITLE"
# Run system checks
system_checks
# main
Expand Down

0 comments on commit 0179189

Please sign in to comment.