% !TEX root = BuildWithGBP.nw% ===> this file was generated automatically by noweave --- better not edit it
\part{Additional components of the script}  

\chapter{Another task} 

\section{Create new branch} \label{sec:NeuenBranchErstellen} \nwfilename{Part5.nw}\nwbegincode{1}\sublabel{NW4N9OxL-1We84c-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-1We84c-1}}}\moddef{CreateNewBranch~{\nwtagstyle{}\subpageref{NW4N9OxL-1We84c-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
function CreateNewBranch \{ 
    # Called by TaskSelect  

    # Creates a new branch (for backports or proposed-updates) 
    DebianBranches 
    whiptail --title "Recent branches" \\ 
    --msgbox "Recent branches:\\n$\{bl\}" 15 60 
    bName="" 
    bName=$(whiptail --inputbox "Name of the new branch:" \\ 
    --cancel-button "Cancel" 15 60 3>&2 2>&1 1>& 3) 
    if [ $\{bName\} != "" ] 
    then 
        ## Create new branch in git 
        git checkout -b $\{bName\} 

        ## Change config file - make new branch to recent one 
        ChangeEntry  

        whiptail --title "New branch was created" \\ 
        --msgbox "New branch $\{bName\} was created" 15 60 
        echo "New branch $\{bName\} was created" >> $\{log\} 
        Distro4Branch 
    fi
 \} 

\LA{}ParseConfig~{\nwtagstyle{}\subpageref{nw@notdef}}\RA{} \nwnotused{CreateNewBranch}\nwendcode{}\nwbegindocs{2}\nwdocspar 

\section{Entering the name or IP of your own Git server} \label{sec:NameEigenerGitServer} 

Mit dieser Funktion, die von der Aufgabenauswahl (Kapitel~\ref{sec:Aufgabenauswahl}, Seite~\pageref{sec:Aufgabenauswahl}) aufgerufen werden kann, werden der Name oder die IP eines eigenen Git-Servers in die Konfigurationsdatei eingetragen. Die Eingabe eines Namens setzt eine funktionierende Namensauflösung voraus. 

\nwenddocs[fuzzy]{}\nwbegincode{3}\sublabel{NW4N9OxL-pLB35-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-pLB35-1}}}\moddef{OwnServer~{\nwtagstyle{}\subpageref{NW4N9OxL-pLB35-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4N9OxL-prxKJ-1}}\nwenddeflinemarkup 
function OwnServer \{ 
    # Called by TaskSelect  

    # Set name or IP of own git server 
    ServerName=$(whiptail --inputbox "Name or IP-address of your git server:" \\ 
    --cancel-button "Cancel" 15 60 3>&2 2>&1 1>&3) 
    if [ -z "$\{ServerName\}" ] 
    then 
        echo "Name or IP of your git server:" 
        read ServerName 
    fi 
    if [ -n "$ServerName" ] 
    then 
        # ReplaceConfigLines needs two parameters: 
        # name of the variable and new value 
        ReplaceConfigLines 'ServerName' $\{ServerName\} 
        AddGitServer 
    fi \} 

\LA{}TaskSelect~{\nwtagstyle{}\subpageref{nw@notdef}}\RA{} \nwused{\\{NW4N9OxL-prxKJ-1}}\nwendcode{}\nwbegindocs{4}\nwdocspar 

\section{Prov. AddGitServer} 

\nwenddocs{}\nwbegincode{5}\sublabel{NW4N9OxL-prxKJ-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-prxKJ-1}}}\moddef{AddGitServer~{\nwtagstyle{}\subpageref{NW4N9OxL-prxKJ-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
function AddGitServer \{ 
    # Called by OwnServer
   serverlist=$(git remote -v) 
    if whiptail --title "Recent remote servers" \\ 
    --yesno "$\{serverlist\}\\nAdd git remote server 'home'?" \\ 
    --yes-button "Yes" \\ --no-button "No" 15 60 
    then 
        AddHomeServer 
    fi
 \} 

\LA{}OwnServer~{\nwtagstyle{}\subpageref{NW4N9OxL-pLB35-1}}\RA{} \nwnotused{AddGitServer}\nwendcode{}\nwbegindocs{6}\nwdocspar 

\chapter{Head of the Script} 

\section{Shebang} [fuzzy]At the beginning of the script are the \textit{Shebang}, notes about the authors, the version and the license.  

\nwenddocs{}\nwbegincode{7}\sublabel{NW4N9OxL-42a6Y2-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-42a6Y2-1}}}\moddef{build-gbp.sh~{\nwtagstyle{}\subpageref{NW4N9OxL-42a6Y2-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash 
 

\LA{}copyright~{\nwtagstyle{}\subpageref{NW4N9OxL-3CaW5t-1}}\RA{} \nwnotused{build-gbp.sh}\nwendcode{}\nwbegindocs{8}\nwdocspar 

\section{Copyright notice} 

he \textit{shebang} is followed by the copyright notice.  

\nwenddocs{}\nwbegincode{9}\sublabel{NW4N9OxL-3CaW5t-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-3CaW5t-1}}}\moddef{copyright~{\nwtagstyle{}\subpageref{NW4N9OxL-3CaW5t-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4N9OxL-42a6Y2-1}}\nwenddeflinemarkup 
 # Copyright 2019-2023 Mechtilde and Michael Stehmann <mechtilde@debian.org> 
 # version 0.8.4  

 # This program 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.  

 # This program 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 this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA.  

\LA{}Dependencies~{\nwtagstyle{}\subpageref{NW4N9OxL-2PiXwE-1}}\RA{} \nwused{\\{NW4N9OxL-42a6Y2-1}}\nwendcode{}\nwbegindocs{10}\nwdocspar 

\section{Dependencies for the program script} \label{sec:scriptdependency} 

\nwenddocs{}\nwbegincode{11}\sublabel{NW4N9OxL-2PiXwE-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-2PiXwE-1}}}\moddef{Dependencies~{\nwtagstyle{}\subpageref{NW4N9OxL-2PiXwE-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4N9OxL-3CaW5t-1}}\nwenddeflinemarkup 
# Dependencies: git-buildpackage, build-essential, less, pbuilder, 
# pristine-tar, sudo, unzip, cowbuilder, cowdancer, debmake, quilt, 
# locate, jq, lintian, devscripts, debhelper 
# sbuild, schroot, debootstrap, apt-cacher-ng, devscripts 
# gradle-debian-helper, maven-debian-helper, libmaven-bundle-plugin-java, 
# mozilla-devscripts, zip 

\LA{}Header~{\nwtagstyle{}\subpageref{NW4N9OxL-2Cop3h-1}}\RA{} \nwused{\\{NW4N9OxL-3CaW5t-1}}\nwendcode{}\nwbegindocs{12}\nwdocspar 

Then the dependencies are listed (chapter \ref{sec:ScriptDependencies}, page \pageref{sec:ScriptDependencies}).  

\section{Function header} \nwenddocs{}\nwbegincode{13}\sublabel{NW4N9OxL-2Cop3h-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-2Cop3h-1}}}\moddef{Header~{\nwtagstyle{}\subpageref{NW4N9OxL-2Cop3h-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4N9OxL-2PiXwE-1}}\nwenddeflinemarkup 
##########################  

# Definitions of functions  

########################## 

\LA{}DebugRP~{\nwtagstyle{}\subpageref{NW4N9OxL-R1FC0-1}}\RA{} \nwused{\\{NW4N9OxL-2PiXwE-1}}\nwendcode{}\nwbegindocs{14}\nwdocspar 

\section{Function for troubleshooting} 

The following function shows a path and allows you to exit the program if necessary.  

It is used for debugging and is normally unused.  

\nwenddocs{}\nwbegincode{15}\sublabel{NW4N9OxL-R1FC0-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4N9OxL-R1FC0-1}}}\moddef{DebugRP~{\nwtagstyle{}\subpageref{NW4N9OxL-R1FC0-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4N9OxL-2Cop3h-1}}\nwenddeflinemarkup 
function DebugRP \{ 
    # Function to show a path and give an opportunity to exit 
    # It is for debugging 
    descstr=$\{1\} pathstr=$\{2\} 
    if ! whiptail --title "Shows the path" \\ 
    --yesno "$\{descstr\}= $\{pathstr\}?" --yes-button "Yes" \\ 
    --no-button "No" 15 60 
    then 
        exit 
    fi
 \} 

\LA{}InsertConfigLine~{\nwtagstyle{}\subpageref{nw@notdef}}\RA{} \nwused{\\{NW4N9OxL-2Cop3h-1}}\nwendcode{}  

\nwixlogsorted{c}{{AddGitServer}{NW4N9OxL-prxKJ-1}{\nwixd{NW4N9OxL-prxKJ-1}}} \nwixlogsorted{c}{{build-gbp.sh}{NW4N9OxL-42a6Y2-1}{\nwixd{NW4N9OxL-42a6Y2-1}}} \nwixlogsorted{c}{{copyright}{NW4N9OxL-3CaW5t-1}{\nwixu{NW4N9OxL-42a6Y2-1}\nwixd{NW4N9OxL-3CaW5t-1}}} \nwixlogsorted{c}{{CreateNewBranch}{NW4N9OxL-1We84c-1}{\nwixd{NW4N9OxL-1We84c-1}}} \nwixlogsorted{c}{{DebugRP}{NW4N9OxL-R1FC0-1}{\nwixu{NW4N9OxL-2Cop3h-1}\nwixd{NW4N9OxL-R1FC0-1}}} \nwixlogsorted{c}{{Dependencies}{NW4N9OxL-2PiXwE-1}{\nwixu{NW4N9OxL-3CaW5t-1}\nwixd{NW4N9OxL-2PiXwE-1}}} \nwixlogsorted{c}{{Header}{NW4N9OxL-2Cop3h-1}{\nwixu{NW4N9OxL-2PiXwE-1}\nwixd{NW4N9OxL-2Cop3h-1}}} \nwixlogsorted{c}{{InsertConfigLine}{nw@notdef}{\nwixu{NW4N9OxL-R1FC0-1}}} \nwixlogsorted{c}{{OwnServer}{NW4N9OxL-pLB35-1}{\nwixd{NW4N9OxL-pLB35-1}\nwixu{NW4N9OxL-prxKJ-1}}} \nwixlogsorted{c}{{ParseConfig}{nw@notdef}{\nwixu{NW4N9OxL-1We84c-1}}} \nwixlogsorted{c}{{TaskSelect}{nw@notdef}{\nwixu{NW4N9OxL-pLB35-1}}} \nwbegindocs{16}\nwdocspar \nwenddocs{}  