Subversion Repositories ALCASAR

Rev

Rev 2423 | Rev 2433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2423 Rev 2432
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2423 2017-10-10 22:11:26Z richard $ 
2
#  $Id: alcasar.sh 2432 2017-10-22 20:56:33Z richard $ 
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
 
5
 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...] 
7
# Ce programme est un logiciel libre ; This software is free and open source
7
# Ce programme est un logiciel libre ; This software is free and open source
Line 391... Line 391...
391
    pbkdf2=`( echo $grub2pwd ; echo $grub2pwd ) | \
391
    pbkdf2=`( echo $grub2pwd ; echo $grub2pwd ) | \
392
        LC_ALL=C /usr/bin/grub2-mkpasswd-pbkdf2 | \
392
        LC_ALL=C /usr/bin/grub2-mkpasswd-pbkdf2 | \
393
        grep -v '[eE]nter password:' | \
393
        grep -v '[eE]nter password:' | \
394
        sed -e "s/PBKDF2 hash of your password is //"`
394
        sed -e "s/PBKDF2 hash of your password is //"`
395
    echo "GRUB2_PASSWORD=$pbkdf2" > /boot/grub2/user.cfg
395
    echo "GRUB2_PASSWORD=$pbkdf2" > /boot/grub2/user.cfg
-
 
396
    [ -e /etc/grub.d/default-10_linux ] || cp /etc/grub.d/10_linux /etc/grub.d/default-10_linux
-
 
397
    cp -f $DIR_CONF/grub-10_linux /etc/grub.d/10_linux  # Request password only on menu editing attempts (not when selecting an entry)
-
 
398
    /usr/bin/update-grub2
396
    chmod 0600 /boot/grub2/user.cfg
399
    chmod 0600 /boot/grub2/user.cfg
397
	echo "# Login name and password to protect GRUB2 boot menu (!!!qwerty keyboard) : " > $PASSWD_FILE
400
	echo "# Login name and password to protect GRUB2 boot menu (!!!qwerty keyboard) : " > $PASSWD_FILE
398
    echo "GRUB2_user=root" >> $PASSWD_FILE
401
    echo "GRUB2_user=root" >> $PASSWD_FILE
399
    echo "GRUB2_password=$grub2pwd" >> $PASSWD_FILE
402
    echo "GRUB2_password=$grub2pwd" >> $PASSWD_FILE
400
	mysqlpwd=`cat /dev/urandom | tr -dc [:alnum:] | head -c16`
403
	mysqlpwd=`cat /dev/urandom | tr -dc [:alnum:] | head -c16`
Line 2181... Line 2184...
2181
	echo "net.ipv6.conf.all.autoconf = 0" >> /etc/sysctl.d/alcasar.conf
2184
	echo "net.ipv6.conf.all.autoconf = 0" >> /etc/sysctl.d/alcasar.conf
2182
	echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.d/alcasar.conf
2185
	echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.d/alcasar.conf
2183
	echo "net.ipv6.conf.default.autoconf = 0" >> /etc/sysctl.d/alcasar.conf
2186
	echo "net.ipv6.conf.default.autoconf = 0" >> /etc/sysctl.d/alcasar.conf
2184
# switch to multi-users runlevel (instead of x11)
2187
# switch to multi-users runlevel (instead of x11)
2185
	ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
2188
	ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
2186
#	GRUB modifications (only one time)
2189
# GRUB2 modifications (Wait time : 3s - ALCASAR entry - VGA=791 - Change the default banner
2187
# Limit wait time to 3s - Create an alcasar entry instead of linux-nonfb - Change the default banner
2190
	[ -e /etc/default/grub.default ]  || cp /etc/default/grub /etc/default/grub.default
2188
#	vm_vga=`lsmod | egrep -c "virtio|vmwgfx"` # test if in VM
2191
	$SED "s?^GRUB_TIMEOUT=.*?GRUB_TIMEOUT=3?g" /etc/default/grub
2189
#	grub_already_modified=`grep -c ALCASAR /boot/grub/menu.lst`
2192
	$SED "s?^GRUB_DISTRIBUTOR=.*?GRUB_DISTRIBUTOR=ALCASAR (on Mageia)?g" /etc/default/grub/
2190
#	[ -e /etc/mageia-release.default ]  || cp /etc/mageia-release /etc/mageia-release.default
2193
	[ -e /etc/mageia-release.default ]  || cp /etc/mageia-release /etc/mageia-release.default
-
 
2194
	vm_vga=`lsmod | egrep -c "virtio|vmwgfx"` # test if in VM
2191
#	if [ $grub_already_modified == 0 ] 
2195
	if [ $vm_vga == 0 ] # is not a VM 
2192
#		then
2196
	then
2193
#		$SED "s?^timeout.*?timeout 3?g" /boot/grub/menu.lst
-
 
2194
#		$SED "s?^title linux?title ALCASAR?g" /boot/grub/menu.lst
2197
        cp -f $DIR_CONF/banner /etc/mageia-release # ALCASAR ASCII-Art
2195
#		$SED "/^kernel/s/splash quiet //" /boot/grub/menu.lst
2198
        echo >> /etc/mageia-release
2196
#		$SED "/^kernel/s/BOOT_IMAGE=linux /BOOT_IMAGE=linux-nonfb /" /boot/grub/menu.lst
2199
        $SED "s?ĜRUB_CMDLINE_LINUX_DEFAULT=\"?&vga=791 ?" /etc/default/grub
2197
#		$SED "/^gfxmenu/d" /boot/grub/menu.lst
-
 
2198
#		if [ $vm_vga == 0 ] # is not a VM 
-
 
2199
#		then
-
 
2200
#			$SED "/BOOT_IMAGE=linux-nonfb/s/$/ vga=791/" /boot/grub/menu.lst  # change display to 1024*768 (vga791) only if not on VM and only on ALCASAR entry
-
 
2201
#		fi
2200
    fi
2202
#	fi
-
 
2203
#	if [ $vm_vga == 0 ] # is not a VM 
2201
    if [ $Lang == "fr" ]
2204
#	then
2202
    then
2205
		cp -f $DIR_CONF/banner /etc/mageia-release
2203
            echo "Bienvenue sur ALCASAR V$VERSION" >> /etc/mageia-release
2206
		echo " V$VERSION" >> /etc/mageia-release
2204
            echo "Connectez-vous à l'URL 'http://alcasar.localdomain/acc'" >> /etc/mageia-release
2207
#	else
2205
    else
2208
#		echo "ALCASAR V$VERSION" > /etc/mageia-release
2206
            echo "Welcome on ALCASAR V$VERSION" >> /etc/mageia-release
-
 
2207
            echo "Connect to 'http://alcasar.localdomain/acc'" >> /etc/mageia-release
2209
#	fi
2208
    fi
2210
# Load and apply the previous conf file
2209
# Load and apply the previous conf file
2211
	if [ "$mode" = "update" ]
2210
	if [ "$mode" = "update" ]
2212
	then
2211
	then
2213
		$DIR_DEST_BIN/alcasar-archive.sh --now # exports current logs in /var/Save/archive
2212
		$DIR_DEST_BIN/alcasar-archive.sh --now # exports current logs in /var/Save/archive
2214
		$DIR_DEST_BIN/alcasar-conf.sh --load
2213
		$DIR_DEST_BIN/alcasar-conf.sh --load