# ! / u s r / b i n / e n v   b a s h 
 
 #   P u b l i c   r e l e a s e   r e p o s i t o r y : 
 
 #       h t t p s : / / e i g h t a r m s . n e t / O c t o p u s / o c t o p u s - r e l e a s e 
 
 s e t   - e u o   p i p e f a i l 
 
 A P P = o c t o p u s 
 
 
 
 M U T E D = ' \ 0 3 3 [ 0 ; 2 m ' 
 
 R E D = ' \ 0 3 3 [ 0 ; 3 1 m ' 
 
 O R A N G E = ' \ 0 3 3 [ 3 8 ; 5 ; 2 1 4 m ' 
 
 N C = ' \ 0 3 3 [ 0 m '   #   N o   C o l o r 
 
 
 
 u s a g e ( )   { 
 
         c a t   < < E O F 
 
 O c t o p u s   I n s t a l l e r 
 
 
 
 U s a g e :   i n s t a l l . s h   [ o p t i o n s ] 
 
 
 
 O p t i o n s : 
 
         - h ,   - - h e l p                             D i s p l a y   t h i s   h e l p   m e s s a g e 
 
         - v ,   - - v e r s i o n   < v e r s i o n >   I n s t a l l   a   s p e c i f i c   v e r s i o n   ( e . g . ,   1 . 0 . 1 8 0 ) 
 
         - b ,   - - b i n a r y   < p a t h >           I n s t a l l   f r o m   a   l o c a l   b i n a r y   i n s t e a d   o f   d o w n l o a d i n g 
 
                 - - n o - m o d i f y - p a t h         D o n ' t   m o d i f y   s h e l l   c o n f i g   f i l e s   ( . z s h r c ,   . b a s h r c ,   e t c . ) 
 
 
 
 E x a m p l e s : 
 
         c u r l   - f s S L   h t t p s : / / e i g h t a r m s . n e t / i n s t a l l   |   b a s h 
 
         c u r l   - f s S L   h t t p s : / / e i g h t a r m s . n e t / i n s t a l l   |   b a s h   - s   - -   - - v e r s i o n   1 . 0 . 1 8 0 
 
         . / i n s t a l l   - - b i n a r y   / p a t h / t o / o c t o p u s 
 
 E O F 
 
 } 
 
 
 
 r e q u e s t e d _ v e r s i o n = $ { V E R S I O N : - } 
 
 n o _ m o d i f y _ p a t h = f a l s e 
 
 b i n a r y _ p a t h = " " 
 
 
 
 w h i l e   [ [   $ #   - g t   0   ] ] ;   d o 
 
         c a s e   " $ 1 "   i n 
 
                 - h | - - h e l p ) 
 
                         u s a g e 
 
                         e x i t   0 
 
                         ; ; 
 
                 - v | - - v e r s i o n ) 
 
                         i f   [ [   - n   " $ { 2 : - } "   ] ] ;   t h e n 
 
                                 r e q u e s t e d _ v e r s i o n = " $ 2 " 
 
                                 s h i f t   2 
 
                         e l s e 
 
                                 e c h o   - e   " $ { R E D } E r r o r :   - - v e r s i o n   r e q u i r e s   a   v e r s i o n   a r g u m e n t $ { N C } " 
 
                                 e x i t   1 
 
                         f i 
 
                         ; ; 
 
                 - b | - - b i n a r y ) 
 
                         i f   [ [   - n   " $ { 2 : - } "   ] ] ;   t h e n 
 
                                 b i n a r y _ p a t h = " $ 2 " 
 
                                 s h i f t   2 
 
                         e l s e 
 
                                 e c h o   - e   " $ { R E D } E r r o r :   - - b i n a r y   r e q u i r e s   a   p a t h   a r g u m e n t $ { N C } " 
 
                                 e x i t   1 
 
                         f i 
 
                         ; ; 
 
                 - - n o - m o d i f y - p a t h ) 
 
                         n o _ m o d i f y _ p a t h = t r u e 
 
                         s h i f t 
 
                         ; ; 
 
                 * ) 
 
                         e c h o   - e   " $ { O R A N G E } W a r n i n g :   U n k n o w n   o p t i o n   ' $ 1 ' $ { N C } "   > & 2 
 
                         s h i f t 
 
                         ; ; 
 
         e s a c 
 
 d o n e 
 
 
 
 I N S T A L L _ D I R = $ H O M E / . o c t o p u s / b i n 
 
 m k d i r   - p   " $ I N S T A L L _ D I R " 
 
 
 
 #   I f   - - b i n a r y   i s   p r o v i d e d ,   s k i p   a l l   d o w n l o a d / d e t e c t i o n   l o g i c 
 
 i f   [   - n   " $ b i n a r y _ p a t h "   ] ;   t h e n 
 
         i f   [   !   - f   " $ b i n a r y _ p a t h "   ] ;   t h e n 
 
                 e c h o   - e   " $ { R E D } E r r o r :   B i n a r y   n o t   f o u n d   a t   $ { b i n a r y _ p a t h } $ { N C } " 
 
                 e x i t   1 
 
         f i 
 
         s p e c i f i c _ v e r s i o n = " l o c a l " 
 
 e l s e 
 
         r a w _ o s = $ ( u n a m e   - s ) 
 
         o s = $ ( e c h o   " $ r a w _ o s "   |   t r   ' [ : u p p e r : ] '   ' [ : l o w e r : ] ' ) 
 
         c a s e   " $ r a w _ o s "   i n 
 
             D a r w i n * )   o s = " d a r w i n "   ; ; 
 
             L i n u x * )   o s = " l i n u x "   ; ; 
 
             M I N G W * | M S Y S * | C Y G W I N * )   o s = " w i n d o w s "   ; ; 
 
         e s a c 
 
 
 
         a r c h = $ ( u n a m e   - m ) 
 
         i f   [ [   " $ a r c h "   = =   " a a r c h 6 4 "   ] ] ;   t h e n 
 
             a r c h = " a r m 6 4 " 
 
         f i 
 
         i f   [ [   " $ a r c h "   = =   " x 8 6 _ 6 4 "   ] ] ;   t h e n 
 
             a r c h = " x 6 4 " 
 
         f i 
 
 
 
         i f   [   " $ o s "   =   " d a r w i n "   ]   & &   [   " $ a r c h "   =   " x 6 4 "   ] ;   t h e n 
 
             r o s e t t a _ f l a g = $ ( s y s c t l   - n   s y s c t l . p r o c _ t r a n s l a t e d   2 > / d e v / n u l l   | |   e c h o   0 ) 
 
             i f   [   " $ r o s e t t a _ f l a g "   =   " 1 "   ] ;   t h e n 
 
                 a r c h = " a r m 6 4 " 
 
             f i 
 
         f i 
 
 
 
         c o m b o = " $ o s - $ a r c h " 
 
         c a s e   " $ c o m b o "   i n 
 
             l i n u x - x 6 4 | l i n u x - a r m 6 4 | d a r w i n - x 6 4 | d a r w i n - a r m 6 4 | w i n d o w s - x 6 4 ) 
 
                 ; ; 
 
             * ) 
 
                 e c h o   - e   " $ { R E D } U n s u p p o r t e d   O S / A r c h :   $ o s / $ a r c h $ { N C } " 
 
                 e x i t   1 
 
                 ; ; 
 
         e s a c 
 
 
 
         a r c h i v e _ e x t = " . z i p " 
 
         i f   [   " $ o s "   =   " l i n u x "   ] ;   t h e n 
 
             a r c h i v e _ e x t = " . t a r . g z " 
 
         f i 
 
 
 
         i s _ m u s l = f a l s e 
 
         i f   [   " $ o s "   =   " l i n u x "   ] ;   t h e n 
 
             i f   [   - f   / e t c / a l p i n e - r e l e a s e   ] ;   t h e n 
 
                 i s _ m u s l = t r u e 
 
             f i 
 
 
 
             i f   c o m m a n d   - v   l d d   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                 i f   l d d   - - v e r s i o n   2 > & 1   |   g r e p   - q i   m u s l ;   t h e n 
 
                     i s _ m u s l = t r u e 
 
                 f i 
 
             f i 
 
         f i 
 
 
 
         n e e d s _ b a s e l i n e = f a l s e 
 
         i f   [   " $ a r c h "   =   " x 6 4 "   ] ;   t h e n 
 
             i f   [   " $ o s "   =   " l i n u x "   ] ;   t h e n 
 
                 i f   !   g r e p   - q w i   a v x 2   / p r o c / c p u i n f o   2 > / d e v / n u l l ;   t h e n 
 
                     n e e d s _ b a s e l i n e = t r u e 
 
                 f i 
 
             f i 
 
 
 
             i f   [   " $ o s "   =   " d a r w i n "   ] ;   t h e n 
 
                 a v x 2 = $ ( s y s c t l   - n   h w . o p t i o n a l . a v x 2 _ 0   2 > / d e v / n u l l   | |   e c h o   0 ) 
 
                 i f   [   " $ a v x 2 "   ! =   " 1 "   ] ;   t h e n 
 
                     n e e d s _ b a s e l i n e = t r u e 
 
                 f i 
 
             f i 
 
 
 
             i f   [   " $ o s "   =   " w i n d o w s "   ] ;   t h e n 
 
                 p s = " ( A d d - T y p e   - M e m b e r D e f i n i t i o n   \ " [ D l l I m p o r t ( \ " \ " k e r n e l 3 2 . d l l \ " \ " ) ]   p u b l i c   s t a t i c   e x t e r n   b o o l   I s P r o c e s s o r F e a t u r e P r e s e n t ( i n t   P r o c e s s o r F e a t u r e ) ; \ "   - N a m e   K e r n e l 3 2   - N a m e s p a c e   W i n 3 2   - P a s s T h r u ) : : I s P r o c e s s o r F e a t u r e P r e s e n t ( 4 0 ) " 
 
                 o u t = " " 
 
                 i f   c o m m a n d   - v   p o w e r s h e l l . e x e   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                     o u t = $ ( p o w e r s h e l l . e x e   - N o P r o f i l e   - N o n I n t e r a c t i v e   - C o m m a n d   " $ p s "   2 > / d e v / n u l l   | |   t r u e ) 
 
                 e l i f   c o m m a n d   - v   p w s h   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                     o u t = $ ( p w s h   - N o P r o f i l e   - N o n I n t e r a c t i v e   - C o m m a n d   " $ p s "   2 > / d e v / n u l l   | |   t r u e ) 
 
                 f i 
 
                 o u t = $ ( e c h o   " $ o u t "   |   t r   - d   ' \ r '   |   t r   ' [ : u p p e r : ] '   ' [ : l o w e r : ] '   |   t r   - d   ' [ : s p a c e : ] ' ) 
 
                 i f   [   " $ o u t "   ! =   " t r u e "   ]   & &   [   " $ o u t "   ! =   " 1 "   ] ;   t h e n 
 
                     n e e d s _ b a s e l i n e = t r u e 
 
                 f i 
 
             f i 
 
         f i 
 
 
 
         t a r g e t = " $ o s - $ a r c h " 
 
         i f   [   " $ n e e d s _ b a s e l i n e "   =   " t r u e "   ] ;   t h e n 
 
             t a r g e t = " $ t a r g e t - b a s e l i n e " 
 
         f i 
 
         i f   [   " $ i s _ m u s l "   =   " t r u e "   ] ;   t h e n 
 
             t a r g e t = " $ t a r g e t - m u s l " 
 
         f i 
 
 
 
         f i l e n a m e = " $ A P P - $ t a r g e t $ a r c h i v e _ e x t " 
 
 
 
 
 
         i f   [   " $ o s "   =   " l i n u x "   ] ;   t h e n 
 
                 i f   !   c o m m a n d   - v   t a r   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                           e c h o   - e   " $ { R E D } E r r o r :   ' t a r '   i s   r e q u i r e d   b u t   n o t   i n s t a l l e d . $ { N C } " 
 
                           e x i t   1 
 
                 f i 
 
         e l s e 
 
                 i f   !   c o m m a n d   - v   u n z i p   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                         e c h o   - e   " $ { R E D } E r r o r :   ' u n z i p '   i s   r e q u i r e d   b u t   n o t   i n s t a l l e d . $ { N C } " 
 
                         e x i t   1 
 
                 f i 
 
         f i 
 
 
 
         i f   [   - z   " $ r e q u e s t e d _ v e r s i o n "   ] ;   t h e n 
 
                 s p e c i f i c _ v e r s i o n = $ ( c u r l   - s   " $ { G I T E A _ A P I _ U R L : - h t t p s : / / e i g h t a r m s . n e t / a p i / v 1 } / r e p o s / O c t o p u s / o c t o p u s - r e l e a s e / r e l e a s e s ? l i m i t = 1 "   |   s e d   - n   ' s / . * " t a g _ n a m e " :   * " v \ ( [ ^ " ] * \ ) " . * / \ 1 / p ' ) 
 
 
 
                 i f   [ [   $ ?   - n e   0   | |   - z   " $ s p e c i f i c _ v e r s i o n "   ] ] ;   t h e n 
 
                         e c h o   - e   " $ { R E D } F a i l e d   t o   f e t c h   v e r s i o n   i n f o r m a t i o n $ { N C } " 
 
                         e x i t   1 
 
                 f i 
 
                 u r l = " $ { O C T O P U S _ D O W N L O A D _ B A S E : - h t t p s : / / e i g h t a r m s . n e t } / O c t o p u s / o c t o p u s - r e l e a s e / r e l e a s e s / d o w n l o a d / v $ { s p e c i f i c _ v e r s i o n } / $ f i l e n a m e " 
 
         e l s e 
 
                 #   S t r i p   l e a d i n g   ' v '   i f   p r e s e n t 
 
                 r e q u e s t e d _ v e r s i o n = " $ { r e q u e s t e d _ v e r s i o n # v } " 
 
                 u r l = " $ { O C T O P U S _ D O W N L O A D _ B A S E : - h t t p s : / / e i g h t a r m s . n e t } / O c t o p u s / o c t o p u s - r e l e a s e / r e l e a s e s / d o w n l o a d / v $ { r e q u e s t e d _ v e r s i o n } / $ f i l e n a m e " 
 
                 s p e c i f i c _ v e r s i o n = $ r e q u e s t e d _ v e r s i o n 
 
 
 
                 #   V e r i f y   t h e   r e l e a s e   e x i s t s   b e f o r e   d o w n l o a d i n g 
 
                 h t t p _ s t a t u s = $ ( c u r l   - s I   - o   / d e v / n u l l   - w   " % { h t t p _ c o d e } "   " $ { G I T E A _ U R L : - h t t p s : / / e i g h t a r m s . n e t } / O c t o p u s / o c t o p u s - r e l e a s e / r e l e a s e s / t a g / v $ { r e q u e s t e d _ v e r s i o n } " ) 
 
                 i f   [   " $ h t t p _ s t a t u s "   =   " 4 0 4 "   ] ;   t h e n 
 
                         e c h o   - e   " $ { R E D } E r r o r :   R e l e a s e   v $ { r e q u e s t e d _ v e r s i o n }   n o t   f o u n d $ { N C } " 
 
                         e c h o   - e   " $ { M U T E D } A v a i l a b l e   r e l e a s e s :   $ { G I T E A _ U R L : - h t t p s : / / e i g h t a r m s . n e t } / O c t o p u s / o c t o p u s - r e l e a s e / r e l e a s e s $ { N C } " 
 
                         e x i t   1 
 
                 f i 
 
         f i 
 
 f i 
 
 
 
 p r i n t _ m e s s a g e ( )   { 
 
         l o c a l   l e v e l = $ 1 
 
         l o c a l   m e s s a g e = $ 2 
 
         l o c a l   c o l o r = " " 
 
 
 
         c a s e   $ l e v e l   i n 
 
                 i n f o )   c o l o r = " $ { N C } "   ; ; 
 
                 w a r n i n g )   c o l o r = " $ { N C } "   ; ; 
 
                 e r r o r )   c o l o r = " $ { R E D } "   ; ; 
 
         e s a c 
 
 
 
         e c h o   - e   " $ { c o l o r } $ { m e s s a g e } $ { N C } " 
 
 } 
 
 
 
 c h e c k _ v e r s i o n ( )   { 
 
         i f   c o m m a n d   - v   o c t o p u s   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                 o c t o p u s _ p a t h = $ ( w h i c h   o c t o p u s ) 
 
 
 
                 # #   C h e c k   t h e   i n s t a l l e d   v e r s i o n 
 
                 i n s t a l l e d _ v e r s i o n = $ ( o c t o p u s   - - v e r s i o n   2 > / d e v / n u l l   | |   e c h o   " " ) 
 
 
 
                 i f   [ [   " $ i n s t a l l e d _ v e r s i o n "   ! =   " $ s p e c i f i c _ v e r s i o n "   ] ] ;   t h e n 
 
                         p r i n t _ m e s s a g e   i n f o   " $ { M U T E D } I n s t a l l e d   v e r s i o n :   $ { N C } $ i n s t a l l e d _ v e r s i o n . " 
 
                 e l s e 
 
                         p r i n t _ m e s s a g e   i n f o   " $ { M U T E D } V e r s i o n   $ { N C } $ s p e c i f i c _ v e r s i o n $ { M U T E D }   a l r e a d y   i n s t a l l e d " 
 
                         e x i t   0 
 
                 f i 
 
         f i 
 
 } 
 
 
 
 u n b u f f e r e d _ s e d ( )   { 
 
         i f   e c h o   |   s e d   - u   - e   " "   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                 s e d   - n u   " $ @ " 
 
         e l i f   e c h o   |   s e d   - l   - e   " "   > / d e v / n u l l   2 > & 1 ;   t h e n 
 
                 s e d   - n l   " $ @ " 
 
         e l s e 
 
                 l o c a l   p a d = " $ ( p r i n t f   " \ n % 5 1 2 s "   " " ) " 
 
                 s e d   - n e   " s / $ / \ \ $ { p a d } / "   " $ @ " 
 
         f i 
 
 } 
 
 
 
 p r i n t _ p r o g r e s s ( )   { 
 
         l o c a l   b y t e s = " $ 1 " 
 
         l o c a l   l e n g t h = " $ 2 " 
 
         [   " $ l e n g t h "   - g t   0   ]   | |   r e t u r n   0 
 
 
 
         l o c a l   w i d t h = 5 0 
 
         l o c a l   p e r c e n t = $ ( (   b y t e s   *   1 0 0   /   l e n g t h   ) ) 
 
         [   " $ p e r c e n t "   - g t   1 0 0   ]   & &   p e r c e n t = 1 0 0 
 
         l o c a l   o n = $ ( (   p e r c e n t   *   w i d t h   /   1 0 0   ) ) 
 
         l o c a l   o f f = $ ( (   w i d t h   -   o n   ) ) 
 
 
 
         l o c a l   f i l l e d = $ ( p r i n t f   " % * s "   " $ o n "   " " ) 
 
         f i l l e d = $ { f i l l e d / /   / ;r
 
         l o c a l   e m p t y = $ ( p r i n t f   " % * s "   " $ o f f "   " " ) 
 
         e m p t y = $ { e m p t y / /   / 
 
 
 
         p r i n t f   " \ r $ { O R A N G E } % s % s   % 3 d % % $ { N C } "   " $ f i l l e d "   " $ e m p t y "   " $ p e r c e n t "   > & 4 
 
 } 
 
 
 
 d o w n l o a d _ w i t h _ p r o g r e s s ( )   { 
 
         l o c a l   u r l = " $ 1 " 
 
         l o c a l   o u t p u t = " $ 2 " 
 
 
 
         i f   [   - t   2   ] ;   t h e n 
 
                 e x e c   4 > & 2 
 
         e l s e 
 
                 e x e c   4 > / d e v / n u l l 
 
         f i 
 
 
 
         l o c a l   t m p _ d i r = $ { T M P D I R : - / t m p } 
 
         l o c a l   b a s e n a m e = " $ { t m p _ d i r } / o c t o p u s _ i n s t a l l _ $ $ " 
 
         l o c a l   t r a c e f i l e = " $ { b a s e n a m e } . t r a c e " 
 
 
 
         r m   - f   " $ t r a c e f i l e " 
 
         m k f i f o   " $ t r a c e f i l e " 
 
 
 
         #   H i d e   c u r s o r 
 
         p r i n t f   " \ 0 3 3 [ ? 2 5 l "   > & 4 
 
 
 
         t r a p   " t r a p   -   R E T U R N ;   r m   - f   \ " $ t r a c e f i l e \ " ;   p r i n t f   ' \ 0 3 3 [ ? 2 5 h '   > & 4 ;   e x e c   4 > & - "   R E T U R N 
 
 
 
         ( 
 
                 c u r l   - - t r a c e - a s c i i   " $ t r a c e f i l e "   - s   - L   - o   " $ o u t p u t "   " $ u r l " 
 
         )   & 
 
         l o c a l   c u r l _ p i d = $ ! 
 
 
 
         u n b u f f e r e d _ s e d   \ 
 
                 - e   ' y / A C D E G H L N O R T V / a c d e g h l n o r t v / '   \ 
 
                 - e   ' / ^ 0 0 0 0 :   c o n t e n t - l e n g t h : / p '   \ 
 
                 - e   ' / ^ < =   r e c v   d a t a / p '   \ 
 
                 " $ t r a c e f i l e "   |   \ 
 
         { 
 
                 l o c a l   l e n g t h = 0 
 
                 l o c a l   b y t e s = 0 
 
 
 
                 w h i l e   I F S = "   "   r e a d   - r   - a   l i n e ;   d o 
 
                         [   " $ { # l i n e [ @ ] } "   - l t   2   ]   & &   c o n t i n u e 
 
                         l o c a l   t a g = " $ { l i n e [ 0 ] }   $ { l i n e [ 1 ] } " 
 
 
 
                         i f   [   " $ t a g "   =   " 0 0 0 0 :   c o n t e n t - l e n g t h : "   ] ;   t h e n 
 
                                 l e n g t h = " $ { l i n e [ 2 ] } " 
 
                                 l e n g t h = $ ( e c h o   " $ l e n g t h "   |   t r   - d   ' \ r ' ) 
 
                                 b y t e s = 0 
 
                         e l i f   [   " $ t a g "   =   " < =   r e c v "   ] ;   t h e n 
 
                                 l o c a l   s i z e = " $ { l i n e [ 3 ] } " 
 
                                 b y t e s = $ ( (   b y t e s   +   s i z e   ) ) 
 
                                 i f   [   " $ l e n g t h "   - g t   0   ] ;   t h e n 
 
                                         p r i n t _ p r o g r e s s   " $ b y t e s "   " $ l e n g t h " 
 
                                 f i 
 
                         f i 
 
                 d o n e 
 
         } 
 
 
 
         w a i t   $ c u r l _ p i d 
 
         l o c a l   r e t = $ ? 
 
         e c h o   " "   > & 4 
 
         r e t u r n   $ r e t 
 
 } 
 
 
 
 d o w n l o a d _ a n d _ i n s t a l l ( )   { 
 
         p r i n t _ m e s s a g e   i n f o   " \ n $ { M U T E D } I n s t a l l i n g   $ { N C } o c t o p u s   $ { M U T E D } v e r s i o n :   $ { N C } $ s p e c i f i c _ v e r s i o n " 
 
         l o c a l   t m p _ d i r = " $ { T M P D I R : - / t m p } / o c t o p u s _ i n s t a l l _ $ $ " 
 
         m k d i r   - p   " $ t m p _ d i r " 
 
 
 
         i f   [ [   " $ o s "   = =   " w i n d o w s "   ] ]   | |   !   [   - t   2   ]   | |   !   d o w n l o a d _ w i t h _ p r o g r e s s   " $ u r l "   " $ t m p _ d i r / $ f i l e n a m e " ;   t h e n 
 
                 #   F a l l b a c k   t o   s t a n d a r d   c u r l   o n   W i n d o w s ,   n o n - T T Y   e n v i r o n m e n t s ,   o r   i f   c u s t o m   p r o g r e s s   f a i l s 
 
                 c u r l   - #   - L   - o   " $ t m p _ d i r / $ f i l e n a m e "   " $ u r l " 
 
         f i 
 
 
 
         i f   [   " $ o s "   =   " l i n u x "   ] ;   t h e n 
 
                 t a r   - x z f   " $ t m p _ d i r / $ f i l e n a m e "   - C   " $ t m p _ d i r " 
 
         e l s e 
 
                 u n z i p   - q   " $ t m p _ d i r / $ f i l e n a m e "   - d   " $ t m p _ d i r " 
 
         f i 
 
 
 
         m v   " $ t m p _ d i r / o c t o p u s "   " $ I N S T A L L _ D I R " 
 
         c h m o d   7 5 5   " $ { I N S T A L L _ D I R } / o c t o p u s " 
 
         r m   - r f   " $ t m p _ d i r " 
 
 } 
 
 
 
 i n s t a l l _ f r o m _ b i n a r y ( )   { 
 
         p r i n t _ m e s s a g e   i n f o   " \ n $ { M U T E D } I n s t a l l i n g   $ { N C } o c t o p u s   $ { M U T E D } f r o m :   $ { N C } $ b i n a r y _ p a t h " 
 
         c p   " $ b i n a r y _ p a t h "   " $ { I N S T A L L _ D I R } / o c t o p u s " 
 
         c h m o d   7 5 5   " $ { I N S T A L L _ D I R } / o c t o p u s " 
 
 } 
 
 
 
 i f   [   - n   " $ b i n a r y _ p a t h "   ] ;   t h e n 
 
         i n s t a l l _ f r o m _ b i n a r y 
 
 e l s e 
 
         c h e c k _ v e r s i o n 
 
         d o w n l o a d _ a n d _ i n s t a l l 
 
 f i 
 
 
 
 
 
 a d d _ t o _ p a t h ( )   { 
 
         l o c a l   c o n f i g _ f i l e = $ 1 
 
         l o c a l   c o m m a n d = $ 2 
 
 
 
         i f   g r e p   - F x q   " $ c o m m a n d "   " $ c o n f i g _ f i l e " ;   t h e n 
 
                 p r i n t _ m e s s a g e   i n f o   " C o m m a n d   a l r e a d y   e x i s t s   i n   $ c o n f i g _ f i l e ,   s k i p p i n g   w r i t e . " 
 
         e l i f   [ [   - w   $ c o n f i g _ f i l e   ] ] ;   t h e n 
 
                 e c h o   - e   " \ n #   o c t o p u s "   > >   " $ c o n f i g _ f i l e " 
 
                 e c h o   " $ c o m m a n d "   > >   " $ c o n f i g _ f i l e " 
 
                 p r i n t _ m e s s a g e   i n f o   " $ { M U T E D } S u c c e s s f u l l y   a d d e d   $ { N C } o c t o p u s   $ { M U T E D } t o   \ $ P A T H   i n   $ { N C } $ c o n f i g _ f i l e " 
 
         e l s e 
 
                 p r i n t _ m e s s a g e   w a r n i n g   " M a n u a l l y   a d d   t h e   d i r e c t o r y   t o   $ c o n f i g _ f i l e   ( o r   s i m i l a r ) : " 
 
                 p r i n t _ m e s s a g e   i n f o   "     $ c o m m a n d " 
 
         f i 
 
 } 
 
 
 
 X D G _ C O N F I G _ H O M E = $ { X D G _ C O N F I G _ H O M E : - $ H O M E / . c o n f i g } 
 
 
 
 c u r r e n t _ s h e l l = $ ( b a s e n a m e   " $ S H E L L " ) 
 
 c a s e   $ c u r r e n t _ s h e l l   i n 
 
         f i s h ) 
 
                 c o n f i g _ f i l e s = " $ H O M E / . c o n f i g / f i s h / c o n f i g . f i s h " 
 
         ; ; 
 
         z s h ) 
 
                 c o n f i g _ f i l e s = " $ { Z D O T D I R : - $ H O M E } / . z s h r c   $ { Z D O T D I R : - $ H O M E } / . z s h e n v   $ X D G _ C O N F I G _ H O M E / z s h / . z s h r c   $ X D G _ C O N F I G _ H O M E / z s h / . z s h e n v " 
 
         ; ; 
 
         b a s h ) 
 
                 c o n f i g _ f i l e s = " $ H O M E / . b a s h r c   $ H O M E / . b a s h _ p r o f i l e   $ H O M E / . p r o f i l e   $ X D G _ C O N F I G _ H O M E / b a s h / . b a s h r c   $ X D G _ C O N F I G _ H O M E / b a s h / . b a s h _ p r o f i l e " 
 
         ; ; 
 
         a s h ) 
 
                 c o n f i g _ f i l e s = " $ H O M E / . a s h r c   $ H O M E / . p r o f i l e   / e t c / p r o f i l e " 
 
         ; ; 
 
         s h ) 
 
                 c o n f i g _ f i l e s = " $ H O M E / . a s h r c   $ H O M E / . p r o f i l e   / e t c / p r o f i l e " 
 
         ; ; 
 
         * ) 
 
                 #   D e f a u l t   c a s e   i f   n o n e   o f   t h e   a b o v e   m a t c h e s 
 
                 c o n f i g _ f i l e s = " $ H O M E / . b a s h r c   $ H O M E / . b a s h _ p r o f i l e   $ X D G _ C O N F I G _ H O M E / b a s h / . b a s h r c   $ X D G _ C O N F I G _ H O M E / b a s h / . b a s h _ p r o f i l e " 
 
         ; ; 
 
 e s a c 
 
 
 
 i f   [ [   " $ n o _ m o d i f y _ p a t h "   ! =   " t r u e "   ] ] ;   t h e n 
 
         c o n f i g _ f i l e = " " 
 
         f o r   f i l e   i n   $ c o n f i g _ f i l e s ;   d o 
 
                 i f   [ [   - f   $ f i l e   ] ] ;   t h e n 
 
                         c o n f i g _ f i l e = $ f i l e 
 
                         b r e a k 
 
                 f i 
 
         d o n e 
 
 
 
         i f   [ [   - z   $ c o n f i g _ f i l e   ] ] ;   t h e n 
 
                 p r i n t _ m e s s a g e   w a r n i n g   " N o   c o n f i g   f i l e   f o u n d   f o r   $ c u r r e n t _ s h e l l .   Y o u   m a y   n e e d   t o   m a n u a l l y   a d d   t o   P A T H : " 
 
                 p r i n t _ m e s s a g e   i n f o   "     e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
         e l i f   [ [   " : $ P A T H : "   ! =   * " : $ I N S T A L L _ D I R : " *   ] ] ;   t h e n 
 
                 c a s e   $ c u r r e n t _ s h e l l   i n 
 
                         f i s h ) 
 
                                 a d d _ t o _ p a t h   " $ c o n f i g _ f i l e "   " f i s h _ a d d _ p a t h   $ I N S T A L L _ D I R " 
 
                         ; ; 
 
                         z s h ) 
 
                                 a d d _ t o _ p a t h   " $ c o n f i g _ f i l e "   " e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
                         ; ; 
 
                         b a s h ) 
 
                                 a d d _ t o _ p a t h   " $ c o n f i g _ f i l e "   " e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
                         ; ; 
 
                         a s h ) 
 
                                 a d d _ t o _ p a t h   " $ c o n f i g _ f i l e "   " e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
                         ; ; 
 
                         s h ) 
 
                                 a d d _ t o _ p a t h   " $ c o n f i g _ f i l e "   " e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
                         ; ; 
 
                         * ) 
 
                                 e x p o r t   P A T H = $ I N S T A L L _ D I R : $ P A T H 
 
                                 p r i n t _ m e s s a g e   w a r n i n g   " M a n u a l l y   a d d   t h e   d i r e c t o r y   t o   $ c o n f i g _ f i l e   ( o r   s i m i l a r ) : " 
 
                                 p r i n t _ m e s s a g e   i n f o   "     e x p o r t   P A T H = $ I N S T A L L _ D I R : \ $ P A T H " 
 
                         ; ; 
 
                 e s a c 
 
         f i 
 
 f i 
 
 
 
 i f   [   - n   " $ { G I T H U B _ A C T I O N S - } "   ]   & &   [   " $ { G I T H U B _ A C T I O N S } "   = =   " t r u e "   ] ;   t h e n 
 
         e c h o   " $ I N S T A L L _ D I R "   > >   $ G I T H U B _ P A T H 
 
         p r i n t _ m e s s a g e   i n f o   " A d d e d   $ I N S T A L L _ D I R   t o   \ $ G I T H U B _ P A T H " 
 
 f i 
 
 
 
 e c h o   - e   " " 
 
 e c h o   - e   " \ 0 3 3 [ 3 8 ; 5 ; 2 1 4 m ;Xxg; ;? ;Xxg; ;   ; ; ;Xxg;   ;Xxg; ;? ;Xxg; ;? ;?   ;? ;Xxg; ; $ { N C } " 
 
 e c h o   - e   " \ 0 3 3 [ 3 8 ; 5 ; 1 7 2 m ;?   ;? ;?           ;?     ;?   ;? ;Xxg; ;   ;?   ;? ; ; ; ;? { N C } " 
 
 e c h o   - e   " \ 0 3 3 [ 3 8 ; 5 ; 1 3 0 m ; ; ; ;   ; ; ; ;       ;       ; ; ; ;   ;         ; ; ; ;   ; ; ; ; $ { N C } " 
 
 e c h o   - e   " " 
 
 e c h o   - e   " " 
 
 e c h o   - e   " $ { M U T E D } O c t o p u s   i n c l u d e s   f r e e   m o d e l s ,   t o   s t a r t : $ { N C } " 
 
 e c h o   - e   " " 
 
 e c h o   - e   " c d   < p r o j e c t >     $ { M U T E D } #   O p e n   d i r e c t o r y $ { N C } " 
 
 e c h o   - e   " o c t o p u s             $ { M U T E D } #   R u n   c o m m a n d $ { N C } " 
 
 e c h o   - e   " " 
 
 e c h o   - e   " $ { M U T E D } F o r   m o r e   i n f o r m a t i o n   v i s i t   $ { N C } h t t p s : / / e i g h t a r m s . n e t / d o c s " 
 
 e c h o   - e   " " 
 
 e c h o   - e   " " 
 
 