cmc/cleberg.net
My personal web garden & blog.
clone: git clone https://gitbay.org/cmc/cleberg.net.git
main: content/blog/2023-11-08-scli.org · raw
1#+date: [2023-11-08 Wed 00:00:00]
2#+title: Signal CLI (scli) on Alpine
3#+description: Installing the Signal CLI client on Alpine Linux.
4#+slug: scli
5#+filetags: :linux:
6
7[[https://github.com/isamert/scli][scli]] is a command-line tool that
8allows you to connect to your Signal messenger account. This program
9utilizes a two-pane display that shows you chats on the left and the
10focused conversation on the right.
11
12This guide will show you how to install =scli= and its dependencies on
13Alpine Linux, which requires some extra work due to musl.
14
15If you're using a non-musl system, you can likely following the =scli=
16README and download the packaged binaries for an easier installation
17process.
18
19* Dependencies
20
21In order to use =scli=, you need a few dependencies:
22
23- =openjdk17-jre= - Used as a dependency for the =signal-cli= tool.
24 Version may vary.
25- =signal-cli= - Used as the backbone of the =scli= tool.
26- =findutils= - Replaces the standard Busybox version of =xargs=.
27- =urwid= - A console user interface library for Python.
28- =urwid-readline= - For GNU emacs-like keybinds on the input line.
29- =qrencode= - Displays a QR code in the terminal to link the device
30 using your phone. Not necessary if you're only linking on desktop and
31 can copy/paste the connection URL.
32
33Let's start by installing the packages available via Alpine's
34repositories. Be sure to install the latest version of =openjdk=. If you
35run into Java-related issues, uninstall =openjdk= and install an older
36version.
37
38#+begin_src sh
39doas apk add openjdk17-jre findutils qrencode
40#+end_src
41
42Next, let's install =signal-cli=. Be sure to export the version of
43=signal-cli= that you want. I use version =0.12.4= below, but that may
44be outdated by the time you're reading this.
45
46#+begin_src sh
47export VERSION="0.12.4"
48wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz
49doas tar xf signal-cli-"${VERSION}".tar.gz -C /opt
50doas ln -sf /opt/signal-cli-${VERSION}"/bin/signal/cli /usr/local/bin
51#+end_src
52
53Finally, install the =urwid= packages using the Python packaging
54utility.
55
56#+begin_src sh
57pip3 install urwid urwid-readline
58#+end_src
59
60* Installation
61
62Now that we have all of the dependencies we need, we can install =scli=.
63Start by simply cloning the repository.
64
65#+begin_src sh
66git clone https://github.com/isamert/scli
67#+end_src
68
69When I cloned this repository on 2023-11-08, I found a bug in the logic
70that required a fix. You must edit the =scli= file and replace the one
71instance of =RLIMIT_OFILE= with =RLIMIT_NOFILE=.
72
73#+begin_src sh
74cd scli
75nano scli
76#+end_src
77
78Once complete, you can move this program to anywhere on your =$PATH=. I
79chose the following directory.
80
81#+begin_src sh
82doas mv scli /usr/local/bin/scli
83#+end_src
84
85* Initial Setup
86
87Now that everything is installed, we can login and configure the client.
88Start by generating a connection link.
89
90#+begin_src sh
91signal-cli link -n "YOUR-DEVICE-NICKNAME" | tee >(xargs -L 1 qrencode -t utf8)
92#+end_src
93
94This will generate a connection link and related QR code for you to use
95to link the devices together. Once complete, *wait patiently* for the
96connection process to finish.
97
98Once it completes, it will exit and return you to the prompt. From here,
99you need to perform an initial =receive= command to start things off.
100The =USERNAME= variable should be your phone number, such as
101=+15551237890=.
102
103#+begin_src sh
104signal-cli -u USERNAME receive
105#+end_src
106
107Also be sure to test the daemon to ensure it works properly. If no
108errors occur, it's working. If you run into errors because you're not
109running a DBUS session, see my notes below.
110
111#+begin_src sh
112signal-cli -u USERNAME daemon
113#+end_src
114
115Once the initial reception is complete, you are ready to use =scli=.
116
117This process will differ depending on your desktop environment (DE). If
118you are running a DE, you likely have a DBUS session running already and
119can simply launch the program.
120
121However, if you're like me and running your computer straight on the TTY
122without a DE, you'll need to start a DBUS session for this program.
123
124#+begin_src sh
125# If you're not running a DBUS session yet, you need to start one for scli
126dbus-run-session -- scli
127
128# OR - If you're already running a DBUS session, simply run scli
129scli
130#+end_src
131
132* Configuration
133
134Lastly, there are a number of configuration options that you can pass
135via the command or in the =~/.config/sclirc= file. See the GitHub README
136for more information on configuration options.
137
138#+begin_src sh
139nano ~/.config/sclirc
140#+end_src
141
142#+begin_src conf
143# ~/.config/sclirc
144
145wrap-at = 80
146enable-notifications = true
147#+end_src
148
149That's it! Following this guide, I have a functional =scli= program that
150successfully sends messages to my contacts and myself!