mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-03 16:40:25 +00:00
96 lines
2.9 KiB
Bash
96 lines
2.9 KiB
Bash
#! /bin/bash
|
|
|
|
# Sudo
|
|
# Source: https://www.sudo.ws/dist/sudo-1.9.14p3.tar.gz
|
|
#
|
|
# $BUILD = Directory to temporarily install
|
|
# $PKGS = Directory to store built packages
|
|
#
|
|
# DEPS
|
|
# Required: None
|
|
# Optional: Linux-PAM, MIT Kerberos V5, OpenLDAP, MTA (that provides a sendmail command), AFS, FWTK, and Opie
|
|
|
|
# If optimizing, use these flags
|
|
export CFLAGS="-march=native -mtune=native -pipe "
|
|
export CFLAGS+="-O3 -ffat-lto-objects -flto=auto -fstack-protector-strong "
|
|
export CFLAGS+="-fzero-call-used-regs=used "
|
|
export LDFLAGS="-Wl,-O2 -Wl,--as-needed "
|
|
|
|
./configure --prefix=/usr \
|
|
--libexecdir=/usr/lib \
|
|
--with-secure-path \
|
|
--with-all-insults \
|
|
--with-env-editor \
|
|
--docdir=/usr/share/doc/sudo-1.9.14p3 \
|
|
--with-passprompt="[sudo] password for %p: " $BUILDTRUPLE &&
|
|
|
|
read -p "Press Enter to compile" && make -j2 &&
|
|
|
|
read -p "Press Enter to install" &&
|
|
# if not using a package manager:
|
|
# make install
|
|
|
|
# if using pkgtools from Slackware, then:
|
|
su -c "make DESTDIR=$BUILD install"
|
|
|
|
read -p "Press Enter to create pakage description."
|
|
cd $BUILD && su -c "mkdir -v install" &&
|
|
cat > /tmp/slack-desc << "EOF"
|
|
# HOW TO EDIT THIS FILE:
|
|
# The "handy ruler" below makes it easier to edit a package description. Line
|
|
# up the first '|' above the ':' following the base package name, and the '|'
|
|
# on the right side marks the last column you can put a character in. You must
|
|
# make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':'.
|
|
|
|
|-----handy-ruler------------------------------------------------------|
|
|
sudo: sudo (give limited root privileges to certain users)
|
|
sudo:
|
|
sudo: 'sudo' is a command that allows users to execute some commands as
|
|
sudo: root. The /etc/sudoers file (edited with 'visudo') specifies which
|
|
sudo: users have access to sudo and which commands they can run. 'sudo'
|
|
sudo: logs all its activities to /var/log/ so the system administrator
|
|
sudo: can keep an eye on things.
|
|
sudo:
|
|
sudo:
|
|
sudo:
|
|
sudo:
|
|
EOF
|
|
su -c "mv /tmp/slack-desc install/" &&
|
|
|
|
su -c "mkdir -pv etc/pam.d"
|
|
|
|
cat > /tmp/sudo << "EOF"
|
|
# Begin /etc/pam.d/sudo
|
|
|
|
# include the default auth settings
|
|
auth include system-auth
|
|
|
|
# include the default account settings
|
|
account include system-account
|
|
|
|
# Set default environment variables for the service user
|
|
session required pam_env.so
|
|
|
|
# include system session defaults
|
|
session include system-session
|
|
|
|
# End /etc/pam.d/sudo
|
|
EOF
|
|
|
|
su -c "mv -v /tmp/sudo etc/pam.d/"
|
|
|
|
su -c "makepkg -l y -c n $PKGS/sudo-1.9.14p3-${PSUFFIX}"
|
|
cp -v install/doinst.sh /tmp/
|
|
cat >> /tmp/doinst.sh << "EOF"
|
|
echo "Setting setuid bit for sudo..."
|
|
chown -v root:root /usr/bin/sudo && chmod -v 4755 /usr/bin/sudo
|
|
EOF
|
|
|
|
su -c "mv /tmp/doinst.sh install/doinst.sh"
|
|
|
|
read -p "Enter to build package" &&
|
|
su -c "makepkg -l y -c n $PKGS/sudo-1.9.14p3-${PSUFFIX}" &&
|
|
su -c "rm -rf $BUILD/*"
|
|
|