aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-07 21:58:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-07 21:58:35 +0200
commit4d484b3903b03828a275a49c9f35fc8d143feb84 (patch)
tree64df184d0510e2e0ea237745e78a2ad87718e4da
parentRename (diff)
downloadjoe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.gz
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.bz2
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.xz
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.zst
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.zip
New script for changing owners
-rwxr-xr-xsrc/gitjoe-chdesc.pl6
-rwxr-xr-xsrc/gitjoe-chowner.pl32
-rwxr-xr-xsrc/gitjoe-newrepo.pl8
3 files changed, 39 insertions, 7 deletions
diff --git a/src/gitjoe-chdesc.pl b/src/gitjoe-chdesc.pl
index 96d5b54..6784f97 100755
--- a/src/gitjoe-chdesc.pl
+++ b/src/gitjoe-chdesc.pl
@@ -6,10 +6,10 @@ use Term::ANSIColor;
sub main {
my $argc = $#ARGV + 1;
- if ($argc < 2) {
+ if ($argc < 3) {
print colored("Failed!\n", 'bold red')
. "Missing argument, 3 needed "
- . colored("[user - reponame - description]", 'bold')
+ . colored("[user - reponame - new description]", 'bold')
. "\n";
exit 1;
}
@@ -21,7 +21,7 @@ sub main {
$repo = $repo . '.git';
}
$repo = $repo . '/';
- open(my $desc_fh, '>:encoding(utf-8)', $home_dir . $repo . 'description');
+ open(my $desc_fh, '>:encoding(UTF-8)', $home_dir . $repo . 'description');
print $desc_fh $desc;
close($desc_fh);
exit;
diff --git a/src/gitjoe-chowner.pl b/src/gitjoe-chowner.pl
new file mode 100755
index 0000000..6d2a5a2
--- /dev/null
+++ b/src/gitjoe-chowner.pl
@@ -0,0 +1,32 @@
+#!/usr/local/bin/perl
+
+use strict;
+use warnings;
+use Term::ANSIColor;
+
+sub main {
+ my $argc = $#ARGV + 1;
+ if ($argc < 3) {
+ print colored("Failed!\n", 'bold red')
+ . "Missing argument, 3 needed "
+ . colored("[user - reponame - new owner]", 'bold')
+ . "\n";
+ exit 1;
+ }
+ my $usr = $ARGV[0];
+ my $repo = $ARGV[1];
+ my $owner = $ARGV[2];
+ my $home_dir = '/usr/home/' . $usr . '/';
+ if (substr($repo, -4) ne '.git') {
+ $repo = $repo . '.git';
+ }
+ $repo = $repo . '/';
+ open(my $owner_fh, '>:encoding(utf-8)', $home_dir . $repo . 'owner');
+ print $owner_fh $owner;
+ close($owner_fh);
+ exit;
+}
+
+main();
+
+__END__
diff --git a/src/gitjoe-newrepo.pl b/src/gitjoe-newrepo.pl
index 98757e7..951b1b5 100755
--- a/src/gitjoe-newrepo.pl
+++ b/src/gitjoe-newrepo.pl
@@ -49,7 +49,7 @@ sub main {
'-c',
'/usr/sbin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . $repo . 'git-daemon-export-ok'
);
- open(my $owner_fh, '>:encoding(utf-8)', $home_dir . $repo . 'owner');
+ open(my $owner_fh, '>:encoding(UTF-8)', $home_dir . $repo . 'owner');
print $owner_fh $usr;
close($owner_fh);
system(
@@ -57,7 +57,7 @@ sub main {
'-c',
'/usr/sbin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . $repo . 'owner'
);
- open(my $url_fh, '>:encoding(utf-8)', $home_dir . $repo . 'url');
+ open(my $url_fh, '>:encoding(UTF-8)', $home_dir . $repo . 'url');
substr($repo, -1) = "";
print $url_fh 'git://jozanleclerc.xyz/' . $usr . '/' . $repo;
close($url_fh);
@@ -68,7 +68,7 @@ sub main {
'/usr/sbin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . $repo . 'url'
);
if ($argc >= 3) {
- open(my $desc_fh, '>:encoding(utf-8)', $home_dir . $repo . 'description');
+ open(my $desc_fh, '>:encoding(UTF-8)', $home_dir . $repo . 'description');
print $desc_fh $desc;
close($desc_fh);
system(
@@ -78,7 +78,7 @@ sub main {
);
}
else {
- open(my $desc_fh, '>:encoding(utf-8)', $home_dir . $repo . 'description');
+ open(my $desc_fh, '>:encoding(UTF-8)', $home_dir . $repo . 'description');
print $desc_fh 'No description yet';
close($desc_fh);
system(