Fix new kernel move

master
Dmitry Razumov 2 years ago
parent baf24e443b
commit 5f7a2de9f8
Signed by: asmeron
GPG Key ID: 50BC1DB583B79706

@ -9,15 +9,15 @@ PATH_KERNEL="/usr/lib/modules"
copy_newkernel_to_boot(){
# Найти все файлы ядра и initramfs и которые отсутствуют
find ${PATH_KERNEL} -maxdepth 2 -name "vmlinuz-*.*.*-*" -print | while read FIND_FILE; do
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null)) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
&& install -CDm400 -o root -g root $(readlink -e ${FIND_FILE}) ${PATH_BOOT}/${FIND_FILE##*/}
done
find ${PATH_KERNEL} -maxdepth 2 -name "ublinux-*.*.*-*" -print | while read FIND_FILE; do
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null)) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
&& install -CDm400 -o root -g root $(readlink -e ${FIND_FILE}) ${PATH_BOOT}/${FIND_FILE##*/}
done
find ${PATH_KERNEL} -maxdepth 2 -name "addon-*.*.*-*" -print | while read FIND_FILE; do
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
[[ $(stat -c%s $(readlink -e ${FIND_FILE} 2>/dev/null)) != $(stat -c%s ${PATH_BOOT}/${FIND_FILE##*/} 2>/dev/null) ]] \
&& install -CDm400 -o root -g root $(readlink -e ${FIND_FILE}) ${PATH_BOOT}/${FIND_FILE##*/}
done
}

@ -27,11 +27,11 @@ set_hostname(){
local SET_HOSTNAME=$1
local SET_DOMAIN=$2
# Удалить предыдущее имя хоста
OLD_HOSTNAME=$(tail -1 ${ROOTFS}/etc/hostname); OLD_HOSTNAME=${OLD_HOSTNAME%%.*}
sed -E -e "s/\s${OLD_HOSTNAME}(\s|$)/ /g" -e "s/\s${OLD_HOSTNAME}(\s|$)/ /g" -e "s/\s${OLD_HOSTNAME}\.[-0-9a-zA-Z.]*(\s|$)/ /g" -e "/^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\s*$/d" -i ${ROOTFS}/etc/hosts
OLD_HOSTNAME=$(tail -1 ${ROOTFS}/etc/hostname 2>/dev/null); OLD_HOSTNAME=${OLD_HOSTNAME%%.*}
[[ -n ${OLD_HOSTNAME} ]] && sed -E -e "s/\s${OLD_HOSTNAME}(\s|$)/ /g" -e "s/\s${OLD_HOSTNAME}(\s|$)/ /g" -e "s/\s${OLD_HOSTNAME}\.[-0-9a-zA-Z.]*(\s|$)/ /g" -e "/^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\s*$/d" -i ${ROOTFS}/etc/hosts
# Если нет новой строки, то вставить
tail -c1 -- ${ROOTFS}/etc/hosts | grep -qx $'\n' || echo >> ${ROOTFS}/etc/hosts
tail -c1 -- ${ROOTFS}/etc/hosts 2>/dev/null| grep -qx $'\n' || echo >> ${ROOTFS}/etc/hosts
HOSTS_1="127.0.0.1 sb-ssl.l.google.com safebrowsing.clients.google.com safebrowsing.cache.l.google.com"
grep -q "^\s*${HOSTS_1}\s*$" ${ROOTFS}/etc/hosts || echo "${HOSTS_1}" >> ${ROOTFS}/etc/hosts

Loading…
Cancel
Save