Skip to content
Snippets Groups Projects
Select Git revision
  • 2135af6886dbddcdb6607766a67039b8aeee937f
  • main default protected
  • ci_test
  • v2.0.27 protected
  • v2.0.26 protected
  • v2.0.25 protected
  • v2.0.24 protected
  • v2.0.23 protected
  • v2.0.22 protected
  • v2.0.21 protected
  • v2.0.20 protected
  • v2.0.19 protected
  • v2.0.18 protected
  • v2.0.17 protected
  • v2.0.16 protected
  • v2.0.15 protected
  • v2.0.14 protected
  • v2.0.13 protected
  • v2.0.12 protected
  • v2.0.11 protected
  • v2.0.10 protected
  • v2.0.9 protected
  • v2.0.8 protected
23 results

build_pipeline_generator.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    common_functions.sh 2.45 KiB
    #!/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/>.
    
    function patch_all()
    {
    	PATCH_DIR="$1"
    	TARGET_DIR="$2"
    
    	if [ ! -d "$PATCH_DIR" ]; then
    		echo "Nothing to patch here!"
    		return 0
    	fi
    	
    	if [ -z "$TARGET_DIR" ]; then
    		echo "No target directory given, assuming /"
    		TARGET_DIR="/"
    	fi
    
            echo "Patching $TARGET_DIR ..."
            for p in "$PATCH_DIR/"*
            do
                    cat "$p" | patch -d "$TARGET_DIR" -p1
            done
            echo "done."
    }
    
    function install_debs()
    {
            DEB_DIR="$1"
    
            if [ ! -d "$DEB_DIR" ]; then
                    echo "Nothing to install here!"
                    return 0
            fi
    
            for p in "$DEB_DIR/"*
            do
    		echo "installing $p..."
                    dpkg -i "$p"
    		echo "done."
            done
    }
    
    function divert_initctl()
    {
            dpkg-divert --local --rename --add /sbin/initctl
            if ! ln -s /bin/true /sbin/initctl; then
    		echo "LIPCK: Failed to divert initctl!"
    		revert_initctl
    		exit 1
    	fi
            # Fix sysvinit legacy invoke-rc.d issue with nonexisting scripts
            dpkg-divert --local --rename --add /usr/sbin/invoke-rc.d
            if ! ln -s /bin/true /usr/sbin/invoke-rc.d; then
    		echo "LIPCK: Failed to divert invoke-rc.d!"
    		revert_initctl
    		exit 1
    	fi
    }
    
    function revert_initctl()
    {
            rm /sbin/initctl
            dpkg-divert --local --rename --remove /sbin/initctl
            # Fix sysvinit legacy invoke-rc.d issue with nonexisting scripts
            rm /usr/sbin/invoke-rc.d
            dpkg-divert --local --rename --remove /usr/sbin/invoke-rc.d
    }
    
    function get_packages_from_file()
    {
            FILENAME="$1"
    
            if [ ! -e "$FILENAME" ]; then
                    echo "Error: package file $FILENAME does not exist!"
                    exit 3
            fi
    
            echo "$(grep -v "^#" "$FILENAME" | tr '\n' ' ')"
    }