From 1b5a41a23af161f38c2e8739dcfe169023437a62 Mon Sep 17 00:00:00 2001
From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Date: Sun, 1 Mar 2015 15:02:04 +0100
Subject: [PATCH] Converted remater_initrd to Makefile

---
 Makefile                   | 21 +++++++++-
 scripts/remaster_initrd.sh | 86 --------------------------------------
 2 files changed, 20 insertions(+), 87 deletions(-)
 delete mode 100755 scripts/remaster_initrd.sh

diff --git a/Makefile b/Makefile
index 5a33eaf..edea228 100644
--- a/Makefile
+++ b/Makefile
@@ -277,7 +277,26 @@ initrd_clean_both:
 
 initrd_remaster : $(ARCH_DIR)$(STATE_DIR)/initrd_remastered
 $(call gentargets,$(STATE_DIR)/initrd_remastered) : $(call archdir,%)$(STATE_DIR)/initrd_extracted $(call archdir,%)$(STATE_DIR)/rootfs_remastered
-	$(CURDIR)/scripts/remaster_initrd.sh "$(CURDIR)" "$(call archdir,$*)$(INITRD)" "$(call archdir,$*)$(ROOTFS)"
+	mkdir -p "$(call archdir,$*)$(INITRD)/lip"
+
+	#nmtelekinese
+	mkdir -p "$(call archdir,$*)$(INITRD)/lip/no-bootloader-icon"
+	cp "$(CURDIR)/contrib/initrd/no-bootloader-icon/ubiquity-kdeui.desktop" "$(call archdir,$*)$(INITRD)/lip/no-bootloader-icon/"
+	cp "$(CURDIR)/contrib/initrd/no-bootloader-icon/25adduser" "$(call archdir,$*)$(INITRD)/scripts/casper-bottom/"
+	chmod +x "$(call archdir,$*)$(INITRD)/scripts/casper-bottom/25adduser"
+
+	#liphook
+	cp "$(CURDIR)/contrib/initrd/initrd_hook/24liphook" "$(call archdir,$*)$(INITRD)/scripts/casper-bottom/"
+	chmod +x "$(call archdir,$*)$(INITRD)/scripts/casper-bottom/24liphook"
+	#TODO generate ORDER
+	cp "$(CURDIR)/contrib/initrd/initrd_hook/ORDER" "$(call archdir,$*)$(INITRD)/scripts/casper-bottom/"
+
+	#install new kernel modules
+	$(RM) "$(call archdir,$*)$(INITRD)/lib/modules/"*
+	version=$$(basename $$(readlink -f "$(call archdir,$*)$(ROOTFS)/vmlinuz") | cut -d'-' -f2-) \
+	cp -a "$(call archdir,$*)$(ROOTFS)/lib/modules/$$version" "$(call archdir,$*)$(INITRD)/lib/modules"
+
+	$(call patch_all,$(CURDIR)/patches/initrd,$(call archdir,$*)$(INITRD))
 	touch "$(call archdir,$*)$(STATE_DIR)/initrd_remastered"
 
 initrd_pack : $(ARCH_DIR)$(INITRD_TARGET)
diff --git a/scripts/remaster_initrd.sh b/scripts/remaster_initrd.sh
deleted file mode 100755
index 35405d0..0000000
--- a/scripts/remaster_initrd.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/bash
-
-#This file is part of lipck - the "linux install party customization kit".
-#
-# Copyright (C) 2014 trilader, Anwarias, Christopher Spinrath
-#
-# lipck is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# lipck is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with lipck.  If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-SCRIPT_DIR="$1"
-IRD="$2"
-ROOTFS="$3"
-
-if [ ! -d "$SCRIPT_DIR" ]; then
-	echo "Expected lipck base path as first argument!"
-	exit 1
-fi
-
-if [ ! -d "$IRD" ]; then
-        echo "Expected initrd root directory as second argument!"
-        exit 2
-fi
-
-if [ ! -d "$ROOTFS" ]; then
-	echo "Expected rootfs directory as third argument!"
-	exit 3
-fi
-
-CONTRIB_DIR="$SCRIPT_DIR/contrib/initrd"
-
-if [ -e "$SCRIPT_DIR/scripts/common_functions.sh" ]; then
-        source "$SCRIPT_DIR/scripts/common_functions.sh"
-fi
-
-function install_nmtelekinese()
-{
-	mkdir -p "$IRD/lip/nm"
-	cp "$CONTRIB_DIR/nmtelekinese/nmtelekinese.desktop" "$IRD/lip/nm"
-	cp "$CONTRIB_DIR/nmtelekinese/nmtelekinese.py" "$IRD/lip/nm"
-	cp "$CONTRIB_DIR/nmtelekinese/26mopsmops" "$IRD/scripts/casper-bottom/"
-	chmod +x "$IRD/scripts/casper-bottom/26mopsmops"
-}
-
-function add_no_bootloader_icon()
-{
-	mkdir -p "$IRD/lip/no-bootloader-icon"
-	cp "$CONTRIB_DIR/no-bootloader-icon/ubiquity-kdeui.desktop" "$IRD/lip/no-bootloader-icon/"
-#	cp "$SCRIPT_DIR/no-bootloader-icon/ubiquity-kdeui-no-bootloader.desktop" "$IRD/lip/no-bootloader-icon/"
-
-	cp "$CONTRIB_DIR/no-bootloader-icon/25adduser" "$IRD/scripts/casper-bottom/"
-	chmod +x "$IRD/scripts/casper-bottom/25adduser"
-}
-
-function install_liphook()
-{
-	cp "$CONTRIB_DIR/initrd_hook/24liphook" "$IRD/scripts/casper-bottom/"
-	chmod +x "$IRD/scripts/casper-bottom/24liphook"
-	cp "$CONTRIB_DIR/initrd_hook/ORDER" "$IRD/scripts/casper-bottom/"
-}
-
-function replace_modules()
-{
-	local version=$(basename $(readlink -f "$ROOTFS/vmlinuz") | cut -d'-' -f2-)
-	rm -rf "$IRD/lib/modules/*"
-	cp -a "$ROOTFS/lib/modules/$version" "$IRD/lib/modules"
-}
-
-mkdir -p "$IRD/lip"
-install_nmtelekinese
-#add_no_bootloader_icon
-install_liphook
-replace_modules
-
-patch_all "$SCRIPT_DIR/patches/initrd" "$IRD"
-- 
GitLab