Add dnf support to installation scripts
parent
1d96716024
commit
79016b9e1c
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
SELECTED_INSTALL_DIR=$1
|
SELECTED_INSTALL_DIR=$1
|
||||||
|
|
||||||
if type pacman > /dev/null 2>&1
|
. ~/.local/opt/script_utils/parse-package-managers-params.bash
|
||||||
|
|
||||||
|
if [ "${RUN[pacman]}" = "1" ]
|
||||||
then
|
then
|
||||||
# Install arch packages
|
# Install arch packages
|
||||||
echo "Installing Arch packages..."
|
echo "Installing Arch packages..."
|
||||||
|
@ -14,25 +16,31 @@ then
|
||||||
done <$SELECTED_INSTALL_DIR/AUR
|
done <$SELECTED_INSTALL_DIR/AUR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type apt > /dev/null 2>&1
|
if [ "${RUN[apt]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing apt packages..."
|
echo "Installing apt packages..."
|
||||||
sudo xargs -a $SELECTED_INSTALL_DIR/apt apt install
|
sudo xargs -a $SELECTED_INSTALL_DIR/apt apt install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type brew > /dev/null 2>&1
|
if [ "${RUN[dnf]}" = "1" ]
|
||||||
|
then
|
||||||
|
echo "Installing dnf packages..."
|
||||||
|
sudo xargs -a $SELECTED_INSTALL_DIR/dnf dnf install
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${RUN[brew]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing brew packages..."
|
echo "Installing brew packages..."
|
||||||
brew bundle --file $SELECTED_INSTALL_DIR/Brewfile
|
brew bundle --file $SELECTED_INSTALL_DIR/Brewfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type flatpak > /dev/null 2>&1
|
if [ "${RUN[flatpak]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing flatpak packages..."
|
echo "Installing flatpak packages..."
|
||||||
xargs -a $SELECTED_INSTALL_DIR/flatpak flatpak install
|
xargs -a $SELECTED_INSTALL_DIR/flatpak flatpak install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type gem > /dev/null 2>&1
|
if [ "${RUN[gem]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing gems..."
|
echo "Installing gems..."
|
||||||
while read gem; do
|
while read gem; do
|
||||||
|
@ -40,13 +48,13 @@ then
|
||||||
done <$( cat $SELECTED_INSTALL_DIR/gem | awk '{print $1}')
|
done <$( cat $SELECTED_INSTALL_DIR/gem | awk '{print $1}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type pip2 > /dev/null 2>&1
|
if [ "${RUN[pip2]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing python2 packages..."
|
echo "Installing python2 packages..."
|
||||||
pip2 install -r $SELECTED_INSTALL_DIR/pip2
|
pip2 install -r $SELECTED_INSTALL_DIR/pip2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if type pip3 > /dev/null 2>&1
|
if [ "${RUN[pip3]}" = "1" ]
|
||||||
then
|
then
|
||||||
echo "Installing python3 packages..."
|
echo "Installing python3 packages..."
|
||||||
pip3 install -r $SELECTED_INSTALL_DIR/pip3
|
pip3 install -r $SELECTED_INSTALL_DIR/pip3
|
||||||
|
|
|
@ -5,4 +5,6 @@ if [ "$PACKAGE_MANAGER" = "pacman" ]; then
|
||||||
echo "sudo pacman -S"
|
echo "sudo pacman -S"
|
||||||
elif [ "$PACKAGE_MANAGER" = "apt" ]; then
|
elif [ "$PACKAGE_MANAGER" = "apt" ]; then
|
||||||
echo "sudo apt install"
|
echo "sudo apt install"
|
||||||
|
elif [ "$PACKAGE_MANAGER" = "dnf" ]; then
|
||||||
|
echo "sudo dnf install"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,5 +9,9 @@ if type pacman > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
PACKAGE_MANAGER="pacman"
|
PACKAGE_MANAGER="pacman"
|
||||||
fi
|
fi
|
||||||
|
if type dnf > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
PACKAGE_MANAGER="dnf"
|
||||||
|
fi
|
||||||
|
|
||||||
echo $PACKAGE_MANAGER
|
echo $PACKAGE_MANAGER
|
||||||
|
|
|
@ -27,6 +27,11 @@ then
|
||||||
sudo dpkg-query -f '${binary:Package}\n' -W > $PACKAGES_DIRECTORY/apt
|
sudo dpkg-query -f '${binary:Package}\n' -W > $PACKAGES_DIRECTORY/apt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if type dnf > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
dnf repoquery --userinstalled > $PACKAGES_DIRECTORY/dnf
|
||||||
|
fi
|
||||||
|
|
||||||
if type flatpak > /dev/null 2>&1
|
if type flatpak > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
flatpak list | cut -f2 > $PACKAGES_DIRECTORY/flatpak
|
flatpak list | cut -f2 > $PACKAGES_DIRECTORY/flatpak
|
||||||
|
|
|
@ -3,53 +3,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
UNAME=$(sh -c 'uname 2>/dev/null || echo Unknown')
|
UNAME=$(sh -c 'uname 2>/dev/null || echo Unknown')
|
||||||
declare -A SKIP=()
|
|
||||||
POSITIONAL=()
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
. ~/.local/opt/script_utils/parse-package-managers-params.bash
|
||||||
key="$1"
|
|
||||||
|
|
||||||
case $key in
|
|
||||||
-s|--skip)
|
|
||||||
shift # past argument
|
|
||||||
SKIP["$1"]=1
|
|
||||||
shift # past value
|
|
||||||
;;
|
|
||||||
*) # unknown option
|
|
||||||
POSITIONAL+=("$1") # save it in an array for later
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
declare -A RUN=()
|
|
||||||
|
|
||||||
for command in "pacman" "apt" "dnf" "flatpak" "gem" "nvim" "asdf" "brew" "pacman";
|
|
||||||
do
|
|
||||||
echo $command
|
|
||||||
if type $command > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
if [ "${SKIP[$command]}" = "1" ]; then
|
|
||||||
RUN[$command]=0
|
|
||||||
else
|
|
||||||
RUN[$command]=1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
RUN[$command]=0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Special case for vim
|
|
||||||
if type -f vim > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
if [ "${SKIP[vim]}" = "1" ]; then
|
|
||||||
RUN[vim]=0
|
|
||||||
else
|
|
||||||
RUN[vim]=1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
RUN[vim]=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${RUN[pacman]}" = "1" ]
|
if [ "${RUN[pacman]}" = "1" ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue