Browse Source

occi: chmod +x systemwide install; create example occidentalis.txt

Brennen Bearnes 11 months ago
parent
commit
9f4470f746
1 changed files with 17 additions and 6 deletions
  1. 17
    6
      occi

+ 17
- 6
occi View File

@@ -514,9 +514,10 @@ sub install {
514 514
 
515 515
   # Copy this script to /usr/local/bin:
516 516
   my $src_path = __FILE__;
517
-  my $basename = basename($src_path);
518
-  if (copy($src_path, '/usr/local/bin/' . $basename)) {
517
+  my $install_path = '/usr/local/bin/' . basename($src_path);
518
+  if (copy($src_path, $install_path)) {
519 519
     diag("copied $src_path -> /usr/local/bin");
520
+    capture_string("chmod a+x $install_path");
520 521
   } else {
521 522
     diag(
522 523
       "copy of $src_path to /usr/local/bin failed - do you need to use sudo?"
@@ -525,11 +526,21 @@ sub install {
525 526
   }
526 527
 
527 528
   # Create a /boot/occidentalis.txt if it doesn't exist:
528
-  if (-e '/boot/occidentalis.txt') {
529
-    diag("Found existing /boot/occidentalis.txt");
529
+  if (-e $OCCI_CONFIG) {
530
+    diag("Found existing $OCCI_CONFIG");
530 531
   } else {
531
-    diag("Creating blank /boot/occidentalis.txt");
532
-    capture_string('touch', '/boot/occidentalis.txt');
532
+    diag("Creating example $OCCI_CONFIG");
533
+    my $occi_text = <<"INI";
534
+# Lines with a leading "#" are comments.  Blank lines are ignored.
535
+
536
+# Uncomment below to set hostname:
537
+# hostname=somepi
538
+
539
+# Uncomment below to configure a wireless network:
540
+# wifi_ssid=somewifinetwork
541
+# wifi_password=somepassword
542
+INI
543
+    put_file($OCCI_CONFIG, $occi_text);
533 544
   }
534 545
 
535 546
   # 3. set up systemd to run this file

Loading…
Cancel
Save