Browse Source

Upload files to ''

Rajneet Kaur 5 years ago
parent
commit
cdaaa708e5

+ 93 - 0
description_of_s_pkgdiff.sh.txt

@@ -0,0 +1,93 @@
+#!/bin/bash
+echo "This script MUST BE runned after s_sloccount.sh script!"
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+
+year_s=2005
+year_e=2018
+---------------------------------------
+In first section of script we declare wich language we use (bash), we enter path of package that will be analize with slocount (variable dir_path) and we declare variables for start year (year_s) and end year (year_e) that will be parsed in package directory. We change working directory in path dir_path.
+---------------------------------------
+
+
+pc_date=`date '+%Y%m%d%H%M'`
+cd $dir_path
+touch -f "$dir_path/pkgdiff_$pc_date.files"
+---------------------------------------
+In the above section we set a new variabe pc_date that will be used for creation of new file named pkgdiff_$pc_date.files.
+---------------------------------------
+
+
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`	
+---------------------------------------
+We start loop for years (03 and 07 - i describe only for 03, for 07 is the same) directory parsing and we change directory in every year to 03 directory (month directory). In evrey year will have 2 subdirectory (03 and 07). With line    echo `pwd`    we will print our path (just for control). The loop itself has two similar sections for month 03 and for month 07.
+---------------------------------------
+
+
+
+	archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		path_archive_f=`readlink -f $archive_f`
+---------------------------------------		
+At this section to archive_f variable will take the value from "ls -S" (-S param is for sort descending, largest first) output, and we will do grep on this output after 3 diferent strings (".tar.", ".orig", ".diff") and after that we print only first line (head -1)
+With    echo $archive_f   we print on screen value of archive_f variable.		
+---------------------------------------
+
+
+
+        source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+		cd $dir_path/$year_dir/03/$source_dir
+		source_dir_path=`pwd`
+		sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+		path_sec_archive_f=`readlink -f $sec_archive_f`
+		count_dir=`ls $dir_path/$year_dir/03/$source_dir | wc -l`
+			if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+		cd ../
+--------------------------------------
+Here is section after typs of archives and which one contain source files will be identified we will check how many directorys contain path of our package:
+        count_dir=`ls $dir_path/$year_dir/03/$source_dir | wc -l`
+After that if count of dir is lower than 3, the path stored in variable $path_sec_archive_f will be written in pkgdiff_$pc_date.files (that was declared in the begining) and if count of dir will be greater than 3, the path stored in variable $path_archive_f will be written in pkgdiff_$pc_date.files.
+            if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+--------------------------------------		
+		
+
+		
+		
+	cd $dir_path
+done
+chmod 444 pkgdiff_$pc_date.files
+for i in `seq 1 27`
+do
+	mkdir report_$i
+	j=$(( $i+1 ))
+	var_pdif_1=`sed -n "$i"p pkgdiff_$pc_date.files`
+	var_pdif_2=`sed -n "$j"p pkgdiff_$pc_date.files`
+	if [[ ( -z $var_pdif_1 ) || ( -z $var_pdif_2 ) ]]; then
+		cd report_$i
+		echo "One or both pkgdiff variable are empty" > sources_files_comp.log
+	else 
+		cd report_$i
+		echo $var_pdif_1 >> sources_files_comp.log
+		echo $var_pdif_2 >> sources_files_comp.log
+		pkgdiff $var_pdif_1 $var_pdif_2
+	fi
+	cd $dir_path
+done
+--------------------------------------
+In above section after we change rights on pkgdiff_$pc_date.files only for reading we create a new loop where i variable can be in range 1 to 27 (this mean (2018-2005)x2months) and we create 2 new variables var_pdif_1 and var_pdif_2 (pkgdiff need 2 variables to compare). In this 2 variables will be stored paths from 
+pkgdiff_$pc_date.files. 
+	var_pdif_1=`sed -n "$i"p pkgdiff_$pc_date.files`
+	var_pdif_2=`sed -n "$j"p pkgdiff_$pc_date.files`
+If variables are empty (for some years can be empty) output will be "One or both pkgdiff variable are empty" and will be written in sources_files_comp.log
+If variables contain paths of sources files, this paths will be written in sources_files_comp.log and after that we run pkgdiff with those 2 paths as variables of pkgdiff application.

+ 72 - 0
description_of_s_sloccont.sh.txt

@@ -0,0 +1,72 @@
+-----------
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+
+year_s=2005
+year_e=2018
+
+cd $dir_path
+-----------
+In first section of script we declare wich language we use (bash), we enter path of package that will be analize with slocount (variable dir_path) and we declare variables for start year (year_s) and end year (year_e) that will be parsed in package directory. We change working directory in path dir_path.
+
+
+-----------
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`
+-----------
+We start loop for years directory parsing and we change directory in every year to 03 directory (month directory). In evrey year will have 2 subdirectory (03 and 07). With line    echo `pwd`    we will print our path (just for control). The loop itself has two similar sections for month 03 and for month 07.
+
+
+-----------
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		echo $archive_f
+-----------
+At this section to archive_f variable will take the value from "ls -S" (-S param is for sort descending, largest first) output, and we will do grep on this output after 3 diferent strings (".tar.", ".orig", ".diff") and after that we print only first line (head -1)
+With    echo $archive_f   we print on screen value of archive_f variable.
+
+
+
+-----------
+		if [[ $archive_f =~ ".gz" ]]; then 
+			echo "File with GZ extension"
+			tar xvzf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount.log
+-----------
+Here is section were will be identified typs of archives and which one contain source files (in many cases we have archive in archive)
+The other  "elif" sections are similar with this "if" section. In this "if" section we will check tar archives with .gz extension 
+		if [[ $archive_f =~ ".gz" ]]; then 
+and in elif sections will check achive files with .xz extension and .bz2 extension. 
+So if archive is with .gz extension then we will unpack archive in line
+			tar xvzf $archive_f
+After that in new created directory from archive we will have source files of package or another archive (tar.gz, tar.xz or tar.bz2), we will do that here
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+If we will find another archive in source directory we will check what kind of archive is and we will unpack in next if and elif statements
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+After all this checks we will change one directory up and we will do slocount on source directory.
+All this will apply for principal archive with .xz or .bz2 extension. 
+After this script will do same verifications for month 07.

+ 121 - 0
description_of_script.sh.txt

@@ -0,0 +1,121 @@
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files: " dir_path
+#read -p "Enter start year: " year_s
+#read -p "Enter end year: " year_e
+
+year_s=2005
+year_e=2018
+
+mkdir $dir_path/$name
+cd $dir_path/$name
+
+for year_dir in `seq $year_s $year_e`
+do
+    mkdir $year_dir
+    cd $year_dir
+    month_list="03 07"
+    for month_dir in $month_list
+        do
+            mkdir $month_dir 
+            cd $month_dir
+            day_list="15 28"
+            for day_of_month in $day_list
+                do
+                day_mom=`curl -q "https://snapshot.debian.org/archive/debian/?year=$year_dir&month=$month_dir" | grep $year_dir$month_dir$day_of_month | awk -F'"' '{print $2}' | awk -F '/' '{print $1}'| tail -n 1`
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" > sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" >> sources_$day_mom.list
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list  
+                cp sources_$day_mom.list /etc/apt/sources.list -f                                                                              
+                apt-get update                                                                                                                 
+                apt-get source --download-only --allow-unauthenticated $name
+                sleep 5
+            done
+            cd $dir_path/$name/$year_dir
+    done
+    cd $dir_path/$name
+done
+cd $dir_path/
+chmod 777 $name -R
+
+
+
+
+Description of script "script.sh"
+------------
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files: " dir_path
+#read -p "Enter start year: " year_s
+#read -p "Enter end year: " year_e
+
+year_s=2005
+year_e=2018
+------------
+In this section i've will be entered name of package that we want to be downloaded and are declared years that will be parsed for that.
+
+
+------------
+mkdir $dir_path/$name
+cd $dir_path/$name
+------------
+In this section we create directory and will chage work directory in that location.
+
+
+------------
+for year_dir in `seq $year_s $year_e`
+do
+------------
+Here we start the loop (will be parsed all years that are in sequence between variables year_s and year_e)
+
+------------
+    mkdir $year_dir
+    cd $year_dir
+    month_list="03 07"
+------------
+here, script will create direcotry for every year that was parsed and we declare a string type variable for months that will be parsed (03 - march and 07 - july)
+
+
+------------
+    for month_dir in $month_list
+        do
+            mkdir $month_dir 
+            cd $month_dir
+            day_list="15 28"
+------------
+Here in second loop we parse months that are declared in variable month_list and will create directory for every month and work directory will be change in this path. We declare vlariable for days that will be parse in every months.
+
+
+------------
+            for day_of_month in $day_list
+                do
+                day_mom=`curl -q "https://snapshot.debian.org/archive/debian/?year=$year_dir&month=$month_dir" | grep $year_dir$month_dir$day_of_month | awk -F'"' '{print $2}' | awk -F '/' '{print $1}'| tail -n 1`
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" > sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" >> sources_$day_mom.list
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list  
+                cp sources_$day_mom.list /etc/apt/sources.list -f                                                                              
+                apt-get update                                                                                                                 
+                apt-get source --download-only --allow-unauthenticated $name
+                sleep 5
+            done
+------------
+In third loop we parse every day declared in day_list variable (15 and 28) and we declare variable day_mom wich actualy is that folder that will indicate location of sources files. For that we use grep, awk and tail commands on output of command curl -q url_name
+After we find day_mom (day momment for a better remember) we generate a new sources.list file with new repository for all years, months and days declared, we copy this new file in /etc/apt/ and we repalce existed one (for this section this script must be run as root). After that we will update repositoryes (apt-get update)
+and we download source of desired package.
+
+
+
+------------
+            done
+            cd $dir_path/$name/$year_dir
+    done
+    cd $dir_path/$name
+done
+cd $dir_path/
+chmod 777 $name -R
+------------
+In this section all loops will be closed and pwath will be changed in up with one directory
+chmod 777 $name -R - this line will change rights for package directory name in full rights for all users.

+ 69 - 0
s_pkgdiff.sh

@@ -0,0 +1,69 @@
+#!/bin/bash
+echo "This script MUST BE runned after s_sloccount.sh script!"
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+
+year_s=2005
+year_e=2018
+
+pc_date=`date '+%Y%m%d%H%M'`
+cd $dir_path
+touch -f "$dir_path/pkgdiff_$pc_date.files"
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		path_archive_f=`readlink -f $archive_f`
+		source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+		cd $dir_path/$year_dir/03/$source_dir
+		source_dir_path=`pwd`
+		sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+		path_sec_archive_f=`readlink -f $sec_archive_f`
+		count_dir=`ls $dir_path/$year_dir/03/$source_dir | wc -l`
+			if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+		cd ../
+
+	cd $dir_path/$year_dir/07
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		path_archive_f=`readlink -f $archive_f`
+		source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+		cd $dir_path/$year_dir/07/$source_dir
+		source_dir_path=`pwd`
+		sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+		path_sec_archive_f=`readlink -f $sec_archive_f`
+		count_dir=`ls $dir_path/$year_dir/07/$source_dir | wc -l`
+			if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+		cd ../
+
+	cd $dir_path
+done
+chmod 444 pkgdiff_$pc_date.files
+for i in `seq 1 27`
+do
+	mkdir report_$i
+	j=$(( $i+1 ))
+	var_pdif_1=`sed -n "$i"p pkgdiff_$pc_date.files`
+	var_pdif_2=`sed -n "$j"p pkgdiff_$pc_date.files`
+	if [[ ( -z $var_pdif_1 ) || ( -z $var_pdif_2 ) ]]; then
+		cd report_$i
+		echo "One or both pkgdiff variable are empty" > sources_files_comp.log
+	else 
+		cd report_$i
+		echo $var_pdif_1 >> sources_files_comp.log
+		echo $var_pdif_2 >> sources_files_comp.log
+		pkgdiff $var_pdif_1 $var_pdif_2
+	fi
+	cd $dir_path
+done
+

+ 68 - 0
s_pkgdiff_year_ask.sh

@@ -0,0 +1,68 @@
+#!/bin/bash
+echo "This script MUST BE runned after s_sloccount.sh script!"
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+read -p "Enter start year: " year_s
+read -p "Enter end year: " year_e
+
+pc_date=`date '+%Y%m%d%H%M'`
+cd $dir_path
+touch -f "$dir_path/pkgdiff_$pc_date.files"
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		path_archive_f=`readlink -f $archive_f`
+		source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+		cd $dir_path/$year_dir/03/$source_dir
+		source_dir_path=`pwd`
+		sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+		path_sec_archive_f=`readlink -f $sec_archive_f`
+		count_dir=`ls $dir_path/$year_dir/03/$source_dir | wc -l`
+			if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+		cd ../
+
+	cd $dir_path/$year_dir/07
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		path_archive_f=`readlink -f $archive_f`
+		source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+		cd $dir_path/$year_dir/07/$source_dir
+		source_dir_path=`pwd`
+		sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+		path_sec_archive_f=`readlink -f $sec_archive_f`
+		count_dir=`ls $dir_path/$year_dir/07/$source_dir | wc -l`
+			if [[ $count_dir -lt 3 ]]; then
+				echo $path_sec_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			else 
+				echo $path_archive_f >> $dir_path/pkgdiff_$pc_date.files
+			fi
+		cd ../
+
+	cd $dir_path
+done
+chmod 444 pkgdiff_$pc_date.files
+for i in `seq 1 27`
+do
+	mkdir report_$i
+	j=$(( $i+1 ))
+	var_pdif_1=`sed -n "$i"p pkgdiff_$pc_date.files`
+	var_pdif_2=`sed -n "$j"p pkgdiff_$pc_date.files`
+	if [[ ( -z $var_pdif_1 ) || ( -z $var_pdif_2 ) ]]; then
+		cd report_$i
+		echo "One or both pkgdiff variable are empty" > sources_files_comp.log
+	else 
+		cd report_$i
+		echo $var_pdif_1 >> sources_files_comp.log
+		echo $var_pdif_2 >> sources_files_comp.log
+		pkgdiff $var_pdif_1 $var_pdif_2
+	fi
+	cd $dir_path
+done
+

+ 122 - 0
s_sloccount.sh

@@ -0,0 +1,122 @@
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+
+year_s=2005
+year_e=2018
+
+cd $dir_path
+
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		echo $archive_f
+		if [[ $archive_f =~ ".gz" ]]; then 
+			echo "File with GZ extension"
+			tar xvzf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		elif [[ $archive_f =~ ".xz" ]]; then 
+			echo "File with XZ extension"
+			tar xvf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		elif [[ $archive_f =~ ".bz2" ]]; then 
+			echo "File with bz2 extension"
+			tar xvjf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		fi
+	cd $dir_path/$year_dir/07
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		echo $archive_f
+		if [[ $archive_f =~ ".gz" ]]; then 
+			echo "File with GZ extension"
+			tar xvzf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		elif [[ $archive_f =~ ".xz" ]]; then 
+			echo "File with XZ extension"
+			tar xvf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		elif [[ $archive_f =~ ".bz2" ]]; then 
+			echo "File with bz2 extension"
+			tar xvjf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		fi
+	cd $dir_path
+	echo `pwd`
+done
+

+ 121 - 0
s_sloccount_year_ask.sh

@@ -0,0 +1,121 @@
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files (ex: /home/jon/$name): " dir_path
+read -p "Enter start year: " year_s
+read -p "Enter end year: " year_e
+
+cd $dir_path
+
+for year_dir in `seq $year_s $year_e`
+do
+	cd $dir_path/$year_dir/03
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		echo $archive_f
+		if [[ $archive_f =~ ".gz" ]]; then 
+			echo "File with GZ extension"
+			tar xvzf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		elif [[ $archive_f =~ ".xz" ]]; then 
+			echo "File with XZ extension"
+			tar xvf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		elif [[ $archive_f =~ ".bz2" ]]; then 
+			echo "File with bz2 extension"
+			tar xvjf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/03/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_03.log
+		fi
+	cd $dir_path/$year_dir/07
+	echo `pwd`	
+		archive_f=`ls -S | grep ".tar." | grep ".orig" | grep -v ".diff" | head -1`
+		echo $archive_f
+		if [[ $archive_f =~ ".gz" ]]; then 
+			echo "File with GZ extension"
+			tar xvzf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		elif [[ $archive_f =~ ".xz" ]]; then 
+			echo "File with XZ extension"
+			tar xvf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		elif [[ $archive_f =~ ".bz2" ]]; then 
+			echo "File with bz2 extension"
+			tar xvjf $archive_f
+			source_dir=`ls --file-type -1 | grep "/" | awk -F '/' '{print $1}'`
+			cd $dir_path/$year_dir/07/$source_dir
+			source_dir_path=`pwd`
+			sec_archive_f=`find $source_dir_path -print | grep -E 'tar.gz|tar.xz|tar.bz2' | grep -v ".diff"`
+			if [[ $sec_archive_f =~ ".gz" ]]; then
+				tar xvzf $sec_archive_f
+			elif [[ $sec_archive_f =~ ".xz" ]]; then 
+				tar xvf $sec_archive_f
+			else
+				tar xvjf $sec_archive_f
+			fi
+			cd ../
+			sloccount $source_dir_path > sloccount\_$year_dir\_07.log
+		fi
+	cd $dir_path
+	echo `pwd`
+done
+

+ 41 - 0
script.sh

@@ -0,0 +1,41 @@
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files: " dir_path
+#read -p "Enter start year: " year_s
+#read -p "Enter end year: " year_e
+
+year_s=2005
+year_e=2018
+
+mkdir $dir_path/$name
+cd $dir_path/$name
+
+for year_dir in `seq $year_s $year_e`
+do
+    mkdir $year_dir
+    cd $year_dir
+    month_list="03 07"
+    for month_dir in $month_list
+        do
+            mkdir $month_dir 
+            cd $month_dir
+            day_list="15 28"
+            for day_of_month in $day_list
+                do
+                day_mom=`curl -q "https://snapshot.debian.org/archive/debian/?year=$year_dir&month=$month_dir" | grep $year_dir$month_dir$day_of_month | awk -F'"' '{print $2}' | awk -F '/' '{print $1}'| tail -n 1`
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" > sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" >> sources_$day_mom.list
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list  
+                cp sources_$day_mom.list /etc/apt/sources.list -f                                                                              
+                apt-get update                                                                                                                 
+                apt-get source --download-only --allow-unauthenticated $name
+                sleep 5
+            done
+            cd $dir_path/$name/$year_dir
+    done
+    cd $dir_path/$name
+done
+cd $dir_path/$name
+chmod 777 * -R

+ 38 - 0
script_year_ask.sh

@@ -0,0 +1,38 @@
+#!/bin/bash
+read -p "Enter package name: " name
+echo "Package name is $name"
+read -p "Enter path for package source files: " dir_path
+read -p "Enter start year: " year_s
+read -p "Enter end year: " year_e
+
+mkdir $dir_path/$name
+cd $dir_path/$name
+
+for year_dir in `seq $year_s $year_e`
+do
+    mkdir $year_dir
+    cd $year_dir
+    month_list="03 07"
+    for month_dir in $month_list
+        do
+            mkdir $month_dir 
+            cd $month_dir
+            day_list="15 28"
+            for day_of_month in $day_list
+                do
+                day_mom=`curl -q "https://snapshot.debian.org/archive/debian/?year=$year_dir&month=$month_dir" | grep $year_dir$month_dir$day_of_month | awk -F'"' '{print $2}' | awk -F '/' '{print $1}'| tail -n 1`
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" > sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable main" >> sources_$day_mom.list
+                echo "deb [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list
+                echo "deb-src [trusted=yes] http://snapshot.debian.org/archive/debian/$day_mom/ stable/updates main" >> sources_$day_mom.list  
+                cp sources_$day_mom.list /etc/apt/sources.list -f                                                                              
+                apt-get update                                                                                                                 
+                apt-get source --download-only --allow-unauthenticated $name
+                sleep 5
+            done
+            cd $dir_path/$name/$year_dir
+    done
+    cd $dir_path/$name
+done
+cd $dir_path/$name
+chmod 777 * -R