#!/usr/bin/env bash ENABLED=yes [[ ${ENABLED} == "yes" ]] || exit 0 SOURCE=/usr/lib/ublinux/default; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null || exit 0 SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null SOURCE=${SYSCONF}/save; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null SOURCE=${SYSCONF}/network; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null PATH_ROOT="" PATH_CHANGES="/memory/changes" NAME_ROOTCOPY="rootcopy" PATH_ROOTCOPY=$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type d -name "${NAME_ROOTCOPY}" | head -1) [[ -n ${PATH_ROOTCOPY} ]] || PATH_ROOTCOPY="$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type f -name "ublinux-data*.sgn" | head -1)" [[ -n ${PATH_ROOTCOPY} ]] && PATH_ROOTCOPY="${PATH_ROOTCOPY%/*}/${NAME_ROOTCOPY}" || exit 0 NAME_MODULES="modules" PATH_MODULES=$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type d -name "${NAME_MODULES}" | head -1) [[ -n ${PATH_MODULES} ]] || PATH_MODULES="$(find ${PATH_ROOT}/memory/layer-base/*/ -maxdepth 1 -type f -name "ublinux-data*.sgn" | head -1)" [[ -n ${PATH_MODULES} ]] && PATH_MODULES="${PATH_MODULES%/*}/${NAME_MODULES}" || exit 0 [[ -n ${PATH_ROOTCOPY} ]] || install -dm0755 -o root -g root "${PATH_ROOTCOPY}" if [[ ${SAVE_ALL_CACHE} == "rootcopy" && -w ${PATH_ROOTCOPY} ]]; then cd ${PATH_CHANGES} # find etc/ -type f -name ld.so.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find etc/udev/ -type f -name hwdb.bin -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/lib/gdk-pixbuf-*/*/ -type f -name loaders.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/lib/locale/ -type f -name locale-archive -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/lib/modules/*/ -type f -name modules. -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/share/applications/ -type f -name mimeinfo.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/share/fonts/ -type f \( -name "fonts.dir" -o -name "fonts.scale" \) -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/share/glib-*/schemas/ -type f -name gschemas.compiled -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/share/icons/ -type f -name icon-theme.cache -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find usr/share/mime/ -maxdepth 1 -type f -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find var/cache/fontconfig/ -type f -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; # find var/cache/ldconfig/ -type f -name aux-cache -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; # install -dm700 ${PATH_ROOTCOPY}/var/cache/ldconfig cp -af etc/pacman.d ${PATH_ROOTCOPY}/etc/ cp -af etc/ssh ${PATH_ROOTCOPY}/etc/ fi # Save DOMAIN settings if [[ -n ${DOMAIN} && -w ${PATH_ROOTCOPY} ]]; then cd ${PATH_CHANGES} find etc/ -type f -name krb5.conf -exec install -CDm644 {} ${PATH_ROOTCOPY}/{} \; find etc/ -type f -name krb5.keytab -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; find etc/ -type f -name realmd.conf -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; find etc/sssd/ -type f -name "*.conf" -exec install -CDm600 {} ${PATH_ROOTCOPY}/{} \; fi