sed changes

This commit is contained in:
i-c-u-p 2022-05-19 16:23:37 +00:00
parent 761a3a5647
commit 84767c0907
No known key found for this signature in database
GPG Key ID: ABB80C12170FC0D1
3 changed files with 8 additions and 12 deletions

View File

@ -39,14 +39,14 @@ echo "
-------------------------------------------------------------------------" -------------------------------------------------------------------------"
TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
if [[ $TOTAL_MEM -gt 8000000 ]]; then if [[ $TOTAL_MEM -gt 8000000 ]]; then
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf sed -i "s/^#\(MAKEFLAGS=\"-j\)2\"/\1$nc\"/;
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf /^COMPRESSXZ=(xz -c -z -)/s/-c /&-T $nc /" /etc/makepkg.conf
fi fi
echo " echo "
------------------------------------------------------------------------- -------------------------------------------------------------------------
Setup Language to US and set locale Setup Language to US and set locale
-------------------------------------------------------------------------" -------------------------------------------------------------------------"
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen sed -i '/^#en_US.UTF-8 /s/^#//' /etc/locale.gen
locale-gen locale-gen
timedatectl --no-ask-password set-timezone ${TIMEZONE} timedatectl --no-ask-password set-timezone ${TIMEZONE}
timedatectl --no-ask-password set-ntp 1 timedatectl --no-ask-password set-ntp 1
@ -56,8 +56,7 @@ ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
localectl --no-ask-password set-keymap ${KEYMAP} localectl --no-ask-password set-keymap ${KEYMAP}
# Add sudo no password rights # Add sudo no password rights
sed -i '/^# %wheel ALL=(ALL) NOPASSWD: ALL/s/^# //' /etc/sudoers sed -Ei 's/^# (%wheel ALL=\(ALL(:ALL)?\) NOPASSWD: ALL)/\1/' /etc/sudoers
sed -i '/^# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/s/^# //' /etc/sudoers
#Add parallel downloading #Add parallel downloading
sed -i '/^#ParallelDownloads/s/^#//' /etc/pacman.conf sed -i '/^#ParallelDownloads/s/^#//' /etc/pacman.conf

View File

@ -143,12 +143,9 @@ echo "
------------------------------------------------------------------------- -------------------------------------------------------------------------
Cleaning Cleaning
-------------------------------------------------------------------------" -------------------------------------------------------------------------"
# Remove no password sudo rights # Remove no password sudo rights, add sudo rights
sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# &/' /etc/sudoers sed -Ei 's/^%wheel ALL=\(ALL(:ALL)?\) NOPASSWD: ALL/# &/;
sed -i 's/^%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# &/' /etc/sudoers s/^# (%wheel ALL=\(ALL(:ALL)?\) ALL)/\1/' /etc/sudoers
# Add sudo rights
sed -i '/^# %wheel ALL=(ALL) ALL/s/^# //' /etc/sudoers
sed -i '/^# %wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers
rm -r $HOME/ArchTitus /home/$USERNAME/ArchTitus rm -r $HOME/ArchTitus /home/$USERNAME/ArchTitus

View File

@ -24,7 +24,7 @@ fi
# @arg $2 string Configuration value. # @arg $2 string Configuration value.
set_option() { set_option() {
if grep -Eq "^${1}.*" $CONFIG_FILE; then # check if option exists if grep -Eq "^${1}.*" $CONFIG_FILE; then # check if option exists
sed -i -e "/^${1}.*/d" $CONFIG_FILE # delete option if exists sed -i "/^${1}.*/d" $CONFIG_FILE # delete option if exists
fi fi
echo "${1}=${2}" >>$CONFIG_FILE # add option echo "${1}=${2}" >>$CONFIG_FILE # add option
} }