Skip to content
Snippets Groups Projects
Select Git revision
  • b7b2943e92252f1d2de1920d9da42c8f37b3aabf
  • tardis default
  • online-lip-2020
  • ss18
  • ws18
  • master protected
  • ws17
  • ss17
  • ws16
  • ss16
  • ws15 protected
  • ss15 protected
  • ws14 protected
  • buildhauer protected
  • ss14 protected
15 results

liprepoctl.sh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    liprepoctl.sh 1.24 KiB
    #!/bin/bash
    
    ACTION="$1"
    FILENAME="/etc/apt/sources.list.d/lipoffline.list"
    ONLINEFILENAME="/etc/apt/sources.list.d/liponline.list"
    ACTIVATED=`test -e "$FILENAME"`
    
    . /etc/lsb-release
    DIST_CODENAME=$DISTRIB_CODENAME
    DIST_VERSION=$DISTRIB_RELEASE
    
    function install_repo()
    {
    	echo "# offline repository of the linux install party
    deb [ arch=amd64 trusted=yes ] file://$1/archives-$DIST_CODENAME $DIST_CODENAME lip" > "$FILENAME"
    	echo "deb http://ftp.halifax.rwth-aachen.de/ubuntu/ impish main restricted universe multiverse
    deb http://ftp.halifax.rwth-aachen.de/ubuntu/ impish-security main restricted universe multiverse
    deb http://ftp.halifax.rwth-aachen.de/ubuntu/ impish-updates main restricted universe multiverse" > "$ONLINEFILENAME"
    }
    
    function uninstall_repo()
    {
    	rm -f "$FILENAME" "$ONLINEFILENAME"
    }
    
    case $ACTION in
    	"on")
    		if [ -z "$2" ]; then
    			echo "No repository location specified!"
    			exit 2
    		fi
    		install_repo "$2"
    		apt-get -o "Dir::Etc::SourceList=$FILENAME" update
    		echo "Repository is now active, remember to call \"$0 off\" to deactivate it when you are done."
    		;;
    	"off")
    		uninstall_repo
    		apt-get update
    		echo "Repository is now inactive."
    		;;
    	"check")
    		echo "State: $ACTIVATED"
    		;;
    	*)
    		echo "Unknown action $ACTION"
    		exit 1
    		;;
    esac