Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NNBnh committed Apr 12, 2021
2 parents b565857 + 3147a9b commit 86a7385
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packageslist
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# EXAMPLE: to see what a good packages list look like, see NNB's file: https://github.com/NNBnh/dots/blob/master/packageslist


### Lable (use "#" to comments)
### Label (use "#" to comments)
APT:firefox # Add some description...
APT:mpv # Each individual package should be on a separate line

Expand Down
87 changes: 52 additions & 35 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ STEPS="${*:-install before home root after}" # Default order of steps
# Functions
install_packages() {
printf '\n\033[1;7;34m%s\033[0m\n' 'Install packages'

# Arch Linux: Add keyring and mirrolis to be able to install packages from 'chaotic-aur'
#$Pacman_COMMAND git base-devel
#git clone 'https://aur.archlinux.org/chaotic-keyring.git' "$TEMPORARY/chaotic-keyring"
#cd "$TEMPORARY/chaotic-keyring" || exit 1
#makepkg --noconfirm
#$PERMISSION_COMMAND pacman --noconfirm --needed --upgrade chaotic-keyring-*.zst
#git clone 'https://aur.archlinux.org/chaotic-mirrorlist.git' "$TEMPORARY/chaotic-mirrorlist"
#cd "$TEMPORARY/chaotic-mirrorlist" || exit 1
#makepkg --noconfirm
#$PERMISSION_COMMAND pacman --noconfirm --needed --upgrade chaotic-mirrorlist-*.zst
#cd "$WD" || exit 1

# For Arco Linux
#$PERMISSION_COMMAND sh -c "printf '\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' >> /etc/pacman.conf"

superbbootstrap_install_packages "$DOTFILES_PATH/packageslist" # you can change packageslist's path here

# Add more packages that you want to install here
Expand Down Expand Up @@ -98,6 +114,17 @@ TEMPORARY="$TMPDIR/superb-bootstrap"

DOTFILES_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

if [ -x "$(command -v sudo)" ]; then
PERMISSION_COMMAND='sudo'
elif [ -x "$(command -v doas)" ]; then
PERMISSION_COMMAND='doas'
elif [ -x "$(command -v termux-setup-storage)" ]; then
PACKAGEMANAGER_MAIN='Termux'
else
printf '\n\033[1;7;31m%s\033[0m\n' "Permission command not found or unsupported"
exit 1
fi

APT_MARK='APT'; APT_PM='apt' ; APT_COMMAND="$PERMISSION_COMMAND $APT_PM install --assume-yes"
Mports_MARK='MPT'; Mports_PM='mports' ; Mports_COMMAND="$PERMISSION_COMMAND $Mports_PM install"
OpenBSD_MARK='OBP'; OpenBSD_PM='pkg_add' ; OpenBSD_COMMAND="$PERMISSION_COMMAND $OpenBSD_PM -I"
Expand All @@ -117,26 +144,25 @@ MacPorts_MARK='MCP'; MacPorts_PM='port' ; MacPorts_COMMAND="$PERMISSION_C
SBO_MARK='SBO'; SBO_PM='sbopkg' ; SBO_COMMAND="$PERMISSION_COMMAND $SBO_PM -ifq"
Snap_MARK='SNA'; Snap_PM='snap' ; Snap_COMMAND="$PERMISSION_COMMAND $Snap_PM install"

case $(uname -s | tr '[:upper:]' '[:lower:]') in
'darwin'*)
PACKAGEMANAGER_LIST='Homebrew MacPorts MAS'
;;
'freebsd'*)
PACKAGEMANAGER_MAIN='PKGNG'
;;
'midnightbsd'*)
PACKAGEMANAGER_MAIN='Mports'
;;
'netbsd'*)
PACKAGEMANAGER_MAIN='PKGIN'
;;
'openbsd'*)
PACKAGEMANAGER_MAIN='OpenBSD'
;;
*)
if [ -x "$(eval command -v termux-setup-storage)" ]; then
PACKAGEMANAGER_MAIN='Termux'
else
if [ -z "$PACKAGEMANAGER_MAIN" ]; then
case $(uname -s | tr '[:upper:]' '[:lower:]') in
'darwin'*)
PACKAGEMANAGER_LIST='Homebrew MacPorts MAS'
;;
'freebsd'*)
PACKAGEMANAGER_MAIN='PKGNG'
;;
'midnightbsd'*)
PACKAGEMANAGER_MAIN='Mports'
;;
'netbsd'*)
PACKAGEMANAGER_MAIN='PKGIN'
;;
'openbsd'*)
PACKAGEMANAGER_MAIN='OpenBSD'
;;
*)

for packagemanager_check in 'APT' 'Pacman' 'Portage' 'Slackpkg' 'XBPS' 'Zypper'; do
[ -x "$(eval command -v \$${packagemanager_check}_PM)" ] && {
PACKAGEMANAGER_MAIN="$packagemanager_check"
Expand All @@ -152,21 +178,11 @@ case $(uname -s | tr '[:upper:]' '[:lower:]') in
if [ "$PACKAGEMANAGER_MAIN" = 'APT' ] || [ "$PACKAGEMANAGER_MAIN" = 'Pacman' ]; then
PACKAGEMANAGER_LIST="$PACKAGEMANAGER_LIST Snap"
fi
fi
;;
esac

PACKAGEMANAGER_LIST="$PACKAGEMANAGER_MAIN $PACKAGEMANAGER_LIST" # This is a list of package managers supported on bootstrapping OS

if [ -x "$(command -v sudo)" ]; then
PERMISSION_COMMAND='sudo'
elif [ -x "$(command -v doas)" ]; then
PERMISSION_COMMAND='doas'
elif [ "$PACKAGEMANAGER_MAIN" != 'Termux' ]; then
printf '\n\033[1;7;31m%s\033[0m\n' "Permission command not found or unsupported"
exit 1
;;
esac
fi

PACKAGEMANAGER_LIST="$PACKAGEMANAGER_MAIN $PACKAGEMANAGER_LIST" # This is a list of package managers supported on bootstrapping OS

# Functions
superbbootstrap_install_packages() {
Expand All @@ -185,7 +201,7 @@ superbbootstrap_install_packages() {
eval "install_command=\"\$${packagemanager}_COMMAND\""

# Find packages with mark
packages_installing=$(printf '%s' "$packages_list" | sed -e "s/^.*$mark://g" -e 's/[[:space:]].*$//g' -e '/^$/d' | tr '\n' ' ')
packages_installing=$(printf '%s' "$packages_list" | sed -e "/^.*$mark:.*\$/!d;s/.*$mark://g" -e 's/[[:space:]].*$//g;/^$/d' | tr '\n' ' ')

# If finded, setup package manager then install packages
[ -n "$packages_installing" ] && {
Expand Down Expand Up @@ -259,7 +275,8 @@ superbbootstrap_AUR() {
$Pacman_COMMAND git base-devel
git clone 'https://aur.archlinux.org/paru.git' "$TEMPORARY/paru"
cd "$TEMPORARY/paru" || exit 1
makepkg -si
makepkg --syncdeps --noconfirm
$PERMISSION_COMMAND $Pacman_PM --needed --noconfirm --upgrade paru-*.zst
cd "$WD" || exit 1
else
printf '%s\n' "Paru has been installed"
Expand Down

0 comments on commit 86a7385

Please # to comment.