From a1abd045808537a22e82df6c2a4fb20e02baf89e Mon Sep 17 00:00:00 2001 From: Fierelier Date: Sat, 22 Apr 2023 17:22:43 +0200 Subject: [PATCH] Add special case for BTRFS when creating swap --- mods/live-installer/data/opt/wdvn/installer/main | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mods/live-installer/data/opt/wdvn/installer/main b/mods/live-installer/data/opt/wdvn/installer/main index f0b0256..602ddee 100755 --- a/mods/live-installer/data/opt/wdvn/installer/main +++ b/mods/live-installer/data/opt/wdvn/installer/main @@ -320,8 +320,14 @@ def main(): print("Creating swap ...") hasSwap = False try: - call(["dd","if=/dev/zero","of=" +ipth("swap"),"bs=1M","count=512","status=progress"]) - call(["chmod","600",ipth("swap")]) + if formatPartition == "btrfs": + call(["truncate","-s","0",ipth("swap")]) + call(["chattr","+C",ipth("swap")]) + call(["fallocate","-l","512M",ipth("swap")]) + else: + call(["dd","if=/dev/zero","of=" +ipth("swap"),"bs=1M","count=512","status=progress"]) + + call(["chmod","0600",ipth("swap")]) call(["mkswap",ipth("swap")]) call(["swapon",ipth("swap")]) except Exception as e: