Compare commits

2 Commits

4 changed files with 71 additions and 119 deletions

View File

@@ -31,14 +31,11 @@ source \
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then if [[ "${disk}" == **/dev/nvme** ]]; then
part1='p1'
part2='p2' part2='p2'
else else
part1='1'
part2='2' part2='2'
fi fi
else else
part1='-part1'
part2='-part2' part2='-part2'
fi fi
@@ -52,7 +49,7 @@ if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then
fi fi
if [[ "${ID}" == 'fedora' ]]; then if [[ "${ID}" == 'fedora' ]]; then
if [[ "${ENCRYPTION}" == 'yes' ]]; then if [[ "${encryption}" == 'yes' ]]; then
cat << EOF | tee /etc/dracut.conf.d/zol.conf &> /dev/null cat << EOF | tee /etc/dracut.conf.d/zol.conf &> /dev/null
nofsck="yes" nofsck="yes"
add_dracutmodules+=" zfs " add_dracutmodules+=" zfs "

View File

@@ -8,40 +8,42 @@ source \
source \ source \
"${BASEDIR}/system.conf" "${BASEDIR}/system.conf"
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${1}" == '--disk' ]]; then
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then if [[ "${disk}" == **/dev/nvme** ]]; then
part3='p3' part3='p3'
else else
part3='3' part3='3'
fi fi
else else
part3='-part3' part3='-part3'
fi fi
swapoff \ swapoff \
--all --all
wipefs \ wipefs \
-a \ -a \
${disk} ${disk}
if [[ ! "${diskType}" == 'HDD' ]]; then if [[ ! "${diskType}" == 'HDD' ]]; then
blkdiscard \ blkdiscard \
-f \ -f \
${disk} ${disk}
fi fi
sgdisk \ sgdisk \
--zap-all \ --zap-all \
${disk} ${disk}
sgdisk \ sgdisk \
-n1:0:+512M \ -n1:0:+512M \
-t1:EF00 \ -t1:EF00 \
-c1:EFI \ -c1:EFI \
${disk} ${disk}
if [[ "${enableSwap}" == "yes" ]]; then if [[ "${enableSwap}" == "yes" ]]; then
swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))" swapSize="$(((($(vmstat -sS M | grep 'total memory' | sed 's/ M total memory//') / 1024) + 1) * 2))"
if [[ "${swapSize#}" -gt '32' ]]; then if [[ "${swapSize#}" -gt '32' ]]; then
@@ -53,15 +55,24 @@ if [[ "${enableSwap}" == "yes" ]]; then
-t2:BF02 \ -t2:BF02 \
-c2:swap \ -c2:swap \
${disk} ${disk}
fi fi
sgdisk \ sgdisk \
-n3:0:0 \ -n3:0:0 \
-t3:BF00 \ -t3:BF00 \
-c3:${ID} \ -c3:${ID} \
${disk} ${disk}
elif [[ "${1}" == '--efi' ]]; then
if [[ ! "${disk}" == **/dev/disk/by-id/** ]]; then
if [[ "${disk}" == **/dev/nvme** ]]; then
part1='p1'
else
part1='1'
fi
else
part1='-part1'
fi
if [[ "${*}" == *--efi* ]]; then
mkdosfs \ mkdosfs \
-F 32 \ -F 32 \
-s 1 \ -s 1 \

View File

@@ -52,11 +52,13 @@ if [[ ! "$(hostname)" == "debian-live" ]]; then
fi fi
"${baseDir}/partition.sh" "${baseDir}/partition.sh" --disk
sleep 5 sleep 5
"${baseDir}/zfs.sh" "${baseDir}/zfs.sh" --format
"${baseDir}/zfs.sh" --create
"${baseDir}/mkdir-tmpfs.sh" "${baseDir}/mkdir-tmpfs.sh"

76
zfs.sh
View File

@@ -20,7 +20,7 @@ else
fi fi
# if [[ ! "${*}" = *--no-part* ]]; then if [[ "${1}" == '--format' ]]; then
if [[ "${encryption}" == 'yes' ]]; then if [[ "${encryption}" == 'yes' ]]; then
zpoolPassword='A' zpoolPassword='A'
zpoolPasswordVerify='B' zpoolPasswordVerify='B'
@@ -105,33 +105,22 @@ fi
${hostname,,} \ ${hostname,,} \
${disk}${part3} ${disk}${part3}
fi fi
fi
if [[ "${1}" == '--create' ]]; then
zfs create \ zfs create \
-o canmount=off \ -o canmount=off \
-o mountpoint=none \ -o mountpoint=none \
${hostname,,}/ROOT ${hostname,,}/ROOT
# else
# zpool import \
# -N \
# -R \
# /mnt \
# ${hostname,,}
#
# zfs load-key \
# -r \
# -L prompt \
# ${hostname,,}
# fi
zfs create \ zfs create \
-o canmount=noauto \ -o canmount=noauto \
-o mountpoint=/ \ -o mountpoint=/ \
${hostname,,}/ROOT/${ID} ${hostname,,}/ROOT/${ID}
zfs mount \ zfs mount \
${hostname,,}/ROOT/${ID} ${hostname,,}/ROOT/${ID}
# if [[ ! "${*}" = *--no-part* ]]; then
zfs create \ zfs create \
${hostname,,}/home ${hostname,,}/home
@@ -213,65 +202,18 @@ zfs mount \
zpool set \ zpool set \
bootfs=${hostname,,}/ROOT/${ID} \ bootfs=${hostname,,}/ROOT/${ID} \
${hostname,,} ${hostname,,}
# else
# zfs mount \
# ${hostname,,}/home
#
# zfs mount \
# ${hostname,,}/home/root
#
# zfs mount \
# ${hostname,,}/var/log
#
# zfs mount \
# ${hostname,,}/var/spool
#
# zfs mount \
# ${hostname,,}/var/cache
#
# zfs mount \
# ${hostname,,}/var/lib/nfs
#
# zfs mount \
# ${hostname,,}/var/tmp
#
# zfs mount \
# ${hostname,,}/srv
#
# zfs mount \
# ${hostname,,}/usr/local
#
# zfs mount \
# ${hostname,,}/var/games
#
# zfs mount \
# ${hostname,,}/var/lib/AccountsService
#
# zfs mount \
# ${hostname,,}/var/lib/NetworkManager
#
# zfs mount \
# ${hostname,,}/var/www
#
# zfs mount \
# ${hostname,,}/keystore
# fi
if [[ "${ID}" == 'fedora' ]]; then if [[ "${ID}" == 'fedora' ]]; then
"${baseDir}/fedora.sh" -1 "${baseDir}/fedora.sh" --rsync
fi fi
# if [[ ! "${*}" = *--no-part* ]]; then
zfs create \ zfs create \
${hostname,,}/var/mail ${hostname,,}/var/mail
chmod \ chmod \
1777 \ 1777 \
/mnt/tmp /mnt/tmp
# else fi
# zfs mount \
# ${hostname,,}/var/mail
# fi
if [[ "${1}" == '--key' ]]; then if [[ "${1}" == '--key' ]]; then
cp \ cp \