mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-02 13:17:19 +02:00
Merge pull request #87 from GreatNovaDragon/main
Several Fixes (freerdp3 command line, able to be run on multiple distros, fixing a typo)
This commit is contained in:
commit
16d5d8d875
51
README.md
51
README.md
@ -1,5 +1,6 @@
|
||||
# winapps
|
||||
The winapps main project
|
||||
|
||||
The winapps main project
|
||||
Originally created by fmstrat https://github.com/Fmstrat/winapps/
|
||||
|
||||
Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNOME/KDE as if they were a part of the native OS, including Nautilus integration for right clicking on files of specific mime types to open them.
|
||||
@ -7,7 +8,9 @@ Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNO
|
||||
<img src="demo/demo.gif" width=1000>
|
||||
|
||||
## How it works
|
||||
|
||||
WinApps was created as an easy, one command way to include apps running inside a VM (or on any RDP server) directly into GNOME as if they were native applications. WinApps works by:
|
||||
|
||||
- Running a Windows RDP server in a background VM container
|
||||
- Checking the RDP server for installed applications such as Microsoft Office
|
||||
- If those programs are installed, it creates shortcuts leveraging FreeRDP for both the CLI and the GNOME tray
|
||||
@ -15,9 +18,11 @@ WinApps was created as an easy, one command way to include apps running inside a
|
||||
- You can right click on any files in your home directory to open with an application, too
|
||||
|
||||
## Currently supported applications
|
||||
### WinApps supports ***ANY*** installed application on your system.
|
||||
|
||||
### WinApps supports **_ANY_** installed application on your system.
|
||||
|
||||
It does this by:
|
||||
|
||||
1. Scanning your system for offically configured applications (below)
|
||||
2. Scanning your system for any other EXE files with install records in the Windows Registry
|
||||
|
||||
@ -75,6 +80,7 @@ Note: The officially configured application list below is fueled by the communit
|
||||
## Installation
|
||||
|
||||
### Step 1: Set up a Windows Virtual Machine
|
||||
|
||||
The best solution for running a VM as a subsystem for WinApps would be KVM. KVM is a CPU and memory-efficient virtualization engine bundled with most major Linux distributions. To set up the VM for WinApps, follow this guide:
|
||||
|
||||
- [Creating a Virtual Machine in KVM](docs/KVM.md)
|
||||
@ -82,8 +88,10 @@ The best solution for running a VM as a subsystem for WinApps would be KVM. KVM
|
||||
If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine `RDPWindows` (auto-IP detection not supported for non-KVM VMs). Directions for both of these can be found in the guide linked above.
|
||||
|
||||
### Step 2: Download the repo and prerequisites
|
||||
|
||||
To get things going, use:
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
sudo apt install -y freerdp2-x11
|
||||
git clone https://github.com/winapps-org/winapps.git
|
||||
cd winapps
|
||||
@ -94,8 +102,10 @@ cd winapps
|
||||
> You can find nightly builds here: https://github.com/FreeRDP/FreeRDP/wiki/Prebuilds
|
||||
|
||||
### Step 3: Creating your WinApps configuration file
|
||||
|
||||
You will need to create a `~/.config/winapps/winapps.conf` configuration file with the following information in it:
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
RDP_USER="MyWindowsUser"
|
||||
RDP_PASS="MyWindowsPassword"
|
||||
#RDP_DOMAIN="MYDOMAIN"
|
||||
@ -104,10 +114,13 @@ RDP_PASS="MyWindowsPassword"
|
||||
#RDP_FLAGS=""
|
||||
#MULTIMON="true"
|
||||
#DEBUG="true"
|
||||
#FREERDP_COMMAND="xfreerdp"
|
||||
```
|
||||
|
||||
The username and password should be a full user account and password, such as the one created when setting up Windows or a domain user. It cannot be a user/PIN combination as those are not valid for RDP access.
|
||||
|
||||
Options:
|
||||
|
||||
- When using a pre-existing non-KVM RDP server, you must use the `RDP_IP` to specify it's location
|
||||
- If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP
|
||||
- For domain users, you can uncomment and change `RDP_DOMAIN`
|
||||
@ -115,15 +128,20 @@ Options:
|
||||
- To add flags to the FreeRDP call, such as `/audio-mode:1` to pass in a mic, use the `RDP_FLAGS` configuration option
|
||||
- For multi-monitor setups, you can try enabling `MULTIMON`, however if you get a black screen (FreeRDP bug) you will need to revert back
|
||||
- If you enable `DEBUG`, a log will be created on each application start in `~/.local/share/winapps/winapps.log`
|
||||
- If you are on a system, where the command for freeredp is not xfreerdp, change `FREERDP_COMMAND` to it.
|
||||
|
||||
### Step 4: Run the WinApps installer
|
||||
|
||||
Lastly, check that FreeRDP can connect with:
|
||||
|
||||
```
|
||||
bin/winapps check
|
||||
```
|
||||
|
||||
You will see output from FreeRDP, as well as potentially have to accept the initial certificate. After that, a Windows Explorer window should pop up. You can close this window and press `Ctrl-C` to cancel out of FreeRDP.
|
||||
|
||||
If this step fails, try restarting the VM, or your problem could be related to:
|
||||
|
||||
- You need to accept the security cert the first time you connect (with 'check')
|
||||
- Not enabling RDP in the Windows VM
|
||||
- Not being able to connect to the IP of the VM
|
||||
@ -131,16 +149,19 @@ If this step fails, try restarting the VM, or your problem could be related to:
|
||||
- Not merging `install/RDPApps.reg` into the VM
|
||||
|
||||
Then the final step is to run the installer which will prompt you for a system or user install:
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
./installer.sh
|
||||
```
|
||||
|
||||
This will take you through the following process:
|
||||
|
||||
<img src="demo/installer.gif" width=1000>
|
||||
|
||||
|
||||
## Adding pre-defined applications
|
||||
|
||||
Adding applications with custom icons and mime types to the installer is easy. Simply copy one of the application configurations in the `apps` folder, and:
|
||||
|
||||
- Edit the variables for the application
|
||||
- Replace the `icon.svg` with an SVG for the application (appropriately licensed)
|
||||
- Re-run the installer
|
||||
@ -149,31 +170,39 @@ Adding applications with custom icons and mime types to the installer is easy. S
|
||||
When running the installer, it will check for if any configured apps are installed, and if they are it will create the appropriate shortcuts on the host OS.
|
||||
|
||||
## Running applications manually
|
||||
|
||||
WinApps offers a manual mode for running applications that are not configured. This is completed with the `manual` flag. Executables that are in the path do not require full path definition.
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
./bin/winapps manual "C:\my\directory\executableNotInPath.exe"
|
||||
./bin/winapps manual executableInPath.exe
|
||||
```
|
||||
|
||||
## Checking for new application support
|
||||
|
||||
The installer can be run multiple times, so simply run the below again and it will remove any current installations and update for the latest applications.
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
./installer.sh
|
||||
```
|
||||
|
||||
## Optional installer command line arguments
|
||||
|
||||
The following optional commands can be used to manage your application configurations without prompts:
|
||||
``` bash
|
||||
|
||||
```bash
|
||||
./installer.sh --user # Configure applications for the current user
|
||||
./installer.sh --system # Configure applications for the entire system
|
||||
./installer.sh --user --uninstall # Remove all configured applications for the current user
|
||||
./installer.sh --system --uninstall # Remove all configured applications for the entire system
|
||||
./installer.sh --user --setupAllOfficiallySupportedApps # Configures all officially supported applications for the current user
|
||||
./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially supported applications for the entire system
|
||||
```
|
||||
|
||||
## Shout outs
|
||||
|
||||
- Some icons pulled from
|
||||
- Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md)
|
||||
- Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md)
|
||||
- Fluent UI - Icons under [MIT License](https://github.com/Fmstrat/fluentui/blob/master/LICENSE) with [restricted use](https://static2.sharepointonline.com/files/fabric/assets/microsoft_fabric_assets_license_agreement_nov_2019.pdf)
|
||||
- PKief's VSCode Material Icon Theme - Icons under [MIT License](https://github.com/Fmstrat/vscode-material-icon-theme/blob/master/LICENSE.md)
|
||||
- DiemenDesign's LibreICONS - Icons under [MIT License](https://github.com/Fmstrat/LibreICONS/blob/master/LICENSE)
|
||||
|
||||
|
@ -8,7 +8,7 @@ FULL_NAME="Internet Explorer"
|
||||
WIN_EXECUTABLE="C:\Program Files\Internet Explorer\iexplore.exe"
|
||||
|
||||
# GNOME categories
|
||||
CATEGORIES="WinApps;Office"
|
||||
CATEGORIES="WinApps;Network;WebBrowser;"
|
||||
|
||||
# GNOME mimetypes
|
||||
MIME_TYPES="text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;"
|
||||
|
49
bin/winapps
49
bin/winapps
@ -4,7 +4,6 @@ if [ ! -f "${HOME}/.config/winapps/winapps.conf" ] && [ ! -f "${HOME}/.winapps"
|
||||
echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..."
|
||||
exit
|
||||
fi
|
||||
|
||||
DIR="$(dirname "$(readlink -f "$0")")"
|
||||
RUN="$(date)-${RANDOM}"
|
||||
|
||||
@ -22,7 +21,7 @@ fi
|
||||
|
||||
function dprint() {
|
||||
if [ "${DEBUG}" = "true" ]; then
|
||||
echo "[${RUN}] ${1}" >> "${HOME}/.local/share/winapps/winapps.log"
|
||||
echo "[${RUN}] ${1}" >>"${HOME}/.local/share/winapps/winapps.log"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -34,74 +33,90 @@ if [ -f "${HOME}/.local/share/winapps/run" ]; then
|
||||
touch "${HOME}/.local/share/winapps/run"
|
||||
THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run")
|
||||
dprint "THIS_RUN:${THIS_RUN}"
|
||||
if (( $THIS_RUN - $LAST_RAN < 2 )); then
|
||||
if ((THIS_RUN - LAST_RAN < 2)); then
|
||||
exit
|
||||
fi
|
||||
else
|
||||
touch "${HOME}/.local/share/winapps/run"
|
||||
fi
|
||||
|
||||
if [ -z "$(which xfreerdp)" ]; then
|
||||
echo "You need xfreerdp!"
|
||||
echo " sudo apt-get install -y freerdp2-x11"
|
||||
if [ -z "${FREERDP_COMMAND}" ]; then
|
||||
if command -v xfreerdp &> /dev/null
|
||||
then
|
||||
FREERDP_COMMAND="xfreerdp"
|
||||
elif command -v xfreerdp3 &> /dev/null
|
||||
then
|
||||
FREERDP_COMMAND="xfreerdp3"
|
||||
fi
|
||||
elif command -v $FREERDP_COMMAND &> /dev/null
|
||||
then
|
||||
dprint "Using custom freerdp command ${FREERDP_COMMAND}"
|
||||
else
|
||||
echo "You have supplied a custom FreeRDP command, but the command is not available."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z "${RDP_IP}" ]; then
|
||||
if [ -z "$(groups |grep libvirt)" ]; then
|
||||
if [ ! "$(groups | grep -v libvirt)" ]; then
|
||||
echo "You are not a member of the libvirt group. Run the below then reboot."
|
||||
echo ' sudo usermod -a -G libvirt $(whoami)'
|
||||
echo ' sudo usermod -a -G kvm $(whoami)'
|
||||
exit
|
||||
fi
|
||||
if [ -z "$(virsh list |grep RDPWindows)" ]; then
|
||||
if [ ! "$(virsh list | grep -v RDPWindows)" ]; then
|
||||
echo "RDPWindows is not running, run:"
|
||||
echo " virsh start RDPWindows"
|
||||
exit
|
||||
fi
|
||||
RDP_IP=$(virsh net-dhcp-leases default |grep RDPWindows |awk '{print $5}')
|
||||
RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}')
|
||||
RDP_IP=${RDP_IP%%\/*}
|
||||
|
||||
fi
|
||||
|
||||
dprint "1:${1}"
|
||||
dprint "2:${2}"
|
||||
# this is just for debug logging anyways
|
||||
# shellcheck disable=SC2145
|
||||
dprint "@:${@}"
|
||||
|
||||
MULTI_FLAG="span"
|
||||
MULTI_FLAG="+span"
|
||||
if [ "${MULTIMON}" = "true" ]; then
|
||||
MULTI_FLAG="multimon"
|
||||
MULTI_FLAG="/multimon"
|
||||
fi
|
||||
|
||||
if [ "${1}" = "windows" ]; then
|
||||
xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} /dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 &
|
||||
$FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 &
|
||||
elif [ "${1}" = "check" ]; then
|
||||
dprint "CHECK"
|
||||
xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"explorer.exe"
|
||||
$FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP}
|
||||
elif [ "${1}" = "manual" ]; then
|
||||
dprint "MANUAL:${2}"
|
||||
xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"${2}" 1> /dev/null 2>&1 &
|
||||
$FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:program:"${2}" /v:"${RDP_IP}" 1>/dev/null 2>&1 &
|
||||
elif [ "${1}" != "install" ]; then
|
||||
dprint "DIR:${DIR}"
|
||||
if [ -e "${DIR}/../apps/${1}/info" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "${DIR}/../apps/${1}/info"
|
||||
ICON="${DIR}/../apps/${1}/icon.svg"
|
||||
elif [ -e "${HOME}/.local/share/winapps/apps/${1}/info" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "${HOME}/.local/share/winapps/apps/${1}/info"
|
||||
ICON="${HOME}/.local/share/winapps/apps/${1}/icon.svg"
|
||||
elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "/usr/local/share/winapps/apps/${1}/info"
|
||||
ICON="/usr/local/share/winapps/apps/${1}/icon.svg"
|
||||
else
|
||||
echo "You need to run 'install.sh' first."
|
||||
echo "You need to run 'installer.sh' first."
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "${2}" ]; then
|
||||
dprint "HOME:${HOME}"
|
||||
FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g')
|
||||
dprint "FILE:${FILE}"
|
||||
xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 &
|
||||
$FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:"${RDP_IP}" 1>/dev/null 2>&1 &
|
||||
else
|
||||
xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 &
|
||||
$FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:"${RDP_IP}" 1>/dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
141
installer.sh
141
installer.sh
@ -1,6 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
if ! command -v bc &> /dev/null
|
||||
then
|
||||
echo "You need bc!"
|
||||
exit
|
||||
fi
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
MAKEDEMO=0
|
||||
USEDEMO=0
|
||||
@ -37,16 +43,16 @@ function waFindInstalled() {
|
||||
cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1
|
||||
for F in $(ls "${DIR}/apps"); do
|
||||
. "${DIR}/apps/${F}/info"
|
||||
echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >> ${HOME}/.local/share/winapps/installed.bat
|
||||
done;
|
||||
echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >> ${HOME}/.local/share/winapps/installed.bat
|
||||
echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >> ${HOME}/.local/share/winapps/installed.bat
|
||||
xfreerdp /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"RDPInstaller" /app:"C:\Windows\System32\cmd.exe" /app-icon:"${DIR}/../icons/windows.svg" /app-cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" 1> /dev/null 2>&1 &
|
||||
echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>${HOME}/.local/share/winapps/installed.bat
|
||||
done
|
||||
echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>${HOME}/.local/share/winapps/installed.bat
|
||||
echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>${HOME}/.local/share/winapps/installed.bat
|
||||
$FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 &
|
||||
COUNT=0
|
||||
while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do
|
||||
sleep 5
|
||||
COUNT=$((COUNT + 1))
|
||||
if (( COUNT == 15 )); then
|
||||
if ((COUNT == 15)); then
|
||||
echo " Finished."
|
||||
echo ""
|
||||
echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:"
|
||||
@ -75,9 +81,10 @@ function waFindInstalled() {
|
||||
}
|
||||
|
||||
function waConfigureApp() {
|
||||
if [ -z "${ICON}" ]; then
|
||||
if [ -z "${ICON}" ]; then
|
||||
ICON=${SYS_PATH}/apps/${1}/icon.${2}
|
||||
fi
|
||||
|
||||
. "${SYS_PATH}/apps/${1}/info"
|
||||
echo -n " Configuring ${NAME}..."
|
||||
if [ ${USEDEMO} != 1 ]; then
|
||||
@ -92,41 +99,47 @@ StartupWMClass=${FULL_NAME}
|
||||
Comment=${FULL_NAME}
|
||||
Categories=${CATEGORIES}
|
||||
MimeType=${MIME_TYPES}
|
||||
" |${SUDO} tee "${APP_PATH}/${1}.desktop" > /dev/null
|
||||
${SUDO} rm -f "${BIN_PATH}/${1}"
|
||||
echo "#!/usr/bin/env bash
|
||||
" | ${SUDO} tee "${APP_PATH}/${1}.desktop" >/dev/null
|
||||
${SUDO} rm -f "${BIN_PATH}/${1}"
|
||||
echo "#!/usr/bin/env bash
|
||||
${BIN_PATH}/winapps ${1} $@
|
||||
" | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null
|
||||
${SUDO} chmod a+x "${BIN_PATH}/${1}"
|
||||
fi
|
||||
echo " Finished."
|
||||
ICON=""
|
||||
|
||||
ICON=""
|
||||
}
|
||||
|
||||
function waConfigureApps() {
|
||||
APPS=()
|
||||
for F in $(cat "${HOME}/.local/share/winapps/installed" |sed 's/\r/\n/g'); do
|
||||
for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do
|
||||
. "${DIR}/apps/${F}/info"
|
||||
APPS+=("${FULL_NAME} (${F})")
|
||||
INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" |tr '[:upper:]' '[:lower:]')")
|
||||
INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')")
|
||||
done
|
||||
IFS=$'\n' APPS=($(sort <<<"${APPS[*]}"))
|
||||
unset IFS
|
||||
OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications")
|
||||
menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}"
|
||||
|
||||
if [ "${INSTALL_TYPE}" != 'User' ]; then
|
||||
menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}"
|
||||
else "grep -l -d skip"
|
||||
menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}"
|
||||
fi
|
||||
if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then
|
||||
checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS
|
||||
echo "" > "${HOME}/.local/share/winapps/installed"
|
||||
echo "" >"${HOME}/.local/share/winapps/installed"
|
||||
for F in "${SELECTED_APPS[@]}"; do
|
||||
APP="${F##*(}"
|
||||
APP="${APP%%)}"
|
||||
echo "${APP}" >> "${HOME}/.local/share/winapps/installed"
|
||||
echo "${APP}" >>"${HOME}/.local/share/winapps/installed"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps"
|
||||
COUNT=0
|
||||
if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then
|
||||
for F in $(cat "${HOME}/.local/share/winapps/installed" |sed 's/\r/\n/g'); do
|
||||
for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do
|
||||
COUNT=$((COUNT + 1))
|
||||
${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps"
|
||||
waConfigureApp "${F}" svg
|
||||
@ -134,7 +147,22 @@ function waConfigureApps() {
|
||||
fi
|
||||
rm -f "${HOME}/.local/share/winapps/installed"
|
||||
rm -f "${HOME}/.local/share/winapps/installed.bat"
|
||||
if (( $COUNT == 0 )); then
|
||||
if (($COUNT == 0)); then
|
||||
echo " No configured applications."
|
||||
fi
|
||||
}
|
||||
|
||||
function waConfigureAppsAllOfficiallySupported(){
|
||||
${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps"
|
||||
COUNT=0
|
||||
for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do
|
||||
COUNT=$((COUNT + 1))
|
||||
${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps"
|
||||
waConfigureApp "${F}" svg
|
||||
done
|
||||
rm -f "${HOME}/.local/share/winapps/installed"
|
||||
rm -f "${HOME}/.local/share/winapps/installed.bat"
|
||||
if (($COUNT == 0)); then
|
||||
echo " No configured applications."
|
||||
fi
|
||||
}
|
||||
@ -146,8 +174,12 @@ function waConfigureDetectedApps() {
|
||||
APPS=()
|
||||
for I in "${!NAMES[@]}"; do
|
||||
EXE=${EXES[$I]##*\\}
|
||||
EXE_LOWER=$(echo "${EXE}" |tr '[:upper:]' '[:lower:]')
|
||||
if ( dlm=$'\x1F' ; IFS="$dlm" ; [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] ) ; then
|
||||
EXE_LOWER=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]')
|
||||
if (
|
||||
dlm=$'\x1F'
|
||||
IFS="$dlm"
|
||||
[[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]]
|
||||
); then
|
||||
APPS+=("${NAMES[$I]} (${EXE})")
|
||||
fi
|
||||
done
|
||||
@ -157,17 +189,17 @@ function waConfigureDetectedApps() {
|
||||
menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}"
|
||||
if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then
|
||||
checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS
|
||||
echo "" > "${HOME}/.local/share/winapps/installed"
|
||||
echo "" >"${HOME}/.local/share/winapps/installed"
|
||||
for F in "${SELECTED_APPS[@]}"; do
|
||||
EXE="${F##*(}"
|
||||
EXE="${EXE%%)}"
|
||||
APP="${F% (*}"
|
||||
echo "${EXE}|${APP}" >> "${HOME}/.local/share/winapps/installed"
|
||||
echo "${EXE}|${APP}" >>"${HOME}/.local/share/winapps/installed"
|
||||
done
|
||||
elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then
|
||||
for I in "${!EXES[@]}"; do
|
||||
EXE=${EXES[$I]##*\\}
|
||||
echo "${EXE}|${NAMES[$I]}" >> "${HOME}/.local/share/winapps/installed"
|
||||
echo "${EXE}|${NAMES[$I]}" >>"${HOME}/.local/share/winapps/installed"
|
||||
done
|
||||
fi
|
||||
COUNT=0
|
||||
@ -177,7 +209,7 @@ function waConfigureDetectedApps() {
|
||||
NAME="${LINE#*|}"
|
||||
for I in "${!NAMES[@]}"; do
|
||||
if [ "${NAME}" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\${EXE}" ]]; then
|
||||
EXE=$(echo "${EXE}" |tr '[:upper:]' '[:lower:]')
|
||||
EXE=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]')
|
||||
${SUDO} mkdir -p "${SYS_PATH}/apps/${EXE}"
|
||||
echo "# GNOME shortcut name
|
||||
NAME=\"${NAME}\"
|
||||
@ -193,23 +225,22 @@ CATEGORIES=\"WinApps\"
|
||||
|
||||
# GNOME mimetypes
|
||||
MIME_TYPES=\"\"
|
||||
" | sudo tee "${SYS_PATH}/apps/${EXE}/info" > /dev/null
|
||||
echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" > /dev/null
|
||||
" | sudo tee "${SYS_PATH}/apps/${EXE}/info" >/dev/null
|
||||
echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" >/dev/null
|
||||
waConfigureApp "${EXE}" ico
|
||||
COUNT=$((COUNT + 1))
|
||||
fi
|
||||
done
|
||||
done < "${HOME}/.local/share/winapps/installed"
|
||||
done <"${HOME}/.local/share/winapps/installed"
|
||||
rm -f "${HOME}/.local/share/winapps/installed"
|
||||
fi
|
||||
rm -f "${HOME}/.local/share/winapps/installed.bat"
|
||||
if (( $COUNT == 0 )); then
|
||||
if (($COUNT == 0)); then
|
||||
echo " No configured applications."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function waConfigureWindows() {
|
||||
echo -n " Configuring Windows..."
|
||||
if [ ${USEDEMO} != 1 ]; then
|
||||
@ -221,15 +252,14 @@ Name=Windows
|
||||
Exec=${BIN_PATH}/winapps windows %F
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=distributor-logo-windows
|
||||
StartupWMClass=Micorosoft Windows
|
||||
Comment=Micorosoft Windows
|
||||
Categories=Windows
|
||||
" |${SUDO} tee "${APP_PATH}/windows.desktop" > /dev/null
|
||||
Icon=${SYS_PATH}/icons/windows.svg
|
||||
StartupWMClass=Microsoft Windows
|
||||
Comment=Microsoft Windows
|
||||
" | ${SUDO} tee "${APP_PATH}/windows.desktop" >/dev/null
|
||||
${SUDO} rm -f "${BIN_PATH}/windows"
|
||||
echo "#!/usr/bin/env bash
|
||||
${BIN_PATH}/winapps windows
|
||||
" |${SUDO} tee "/${BIN_PATH}/windows" > /dev/null
|
||||
" | ${SUDO} tee "/${BIN_PATH}/windows" >/dev/null
|
||||
${SUDO} chmod a+x "${BIN_PATH}/windows"
|
||||
fi
|
||||
echo " Finished."
|
||||
@ -238,12 +268,12 @@ ${BIN_PATH}/winapps windows
|
||||
function waUninstallUser() {
|
||||
rm -f "${HOME}/.local/bin/winapps"
|
||||
rm -rf "${HOME}/.local/share/winapps"
|
||||
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"*); do
|
||||
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"* -s); do
|
||||
echo -n " Removing ${F}..."
|
||||
${SUDO} rm ${F}
|
||||
echo " Finished."
|
||||
done
|
||||
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"*); do
|
||||
for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"* -s); do
|
||||
echo -n " Removing ${F}..."
|
||||
${SUDO} rm ${F}
|
||||
echo " Finished."
|
||||
@ -253,7 +283,7 @@ function waUninstallUser() {
|
||||
function waUninstallSystem() {
|
||||
${SUDO} rm -f "/usr/local/bin/winapps"
|
||||
${SUDO} rm -rf "/usr/local/share/winapps"
|
||||
for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"*); do
|
||||
for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s); do
|
||||
if [ -z "${SUDO}" ]; then
|
||||
waNoSudo
|
||||
fi
|
||||
@ -261,7 +291,7 @@ function waUninstallSystem() {
|
||||
${SUDO} rm ${F}
|
||||
echo " Finished."
|
||||
done
|
||||
for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"*); do
|
||||
for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s); do
|
||||
if [ -z "${SUDO}" ]; then
|
||||
waNoSudo
|
||||
fi
|
||||
@ -287,19 +317,32 @@ if [ "${INSTALL_TYPE}" = 'User' ]; then
|
||||
BIN_PATH="${HOME}/.local/bin"
|
||||
APP_PATH="${HOME}/.local/share/applications"
|
||||
SYS_PATH="${HOME}/.local/share/winapps"
|
||||
mkdir -p $BIN_PATH
|
||||
mkdir -p $APP_PATH
|
||||
mkdir -p $SYS_PATH
|
||||
if [ -n "${2}" ]; then
|
||||
if [ "${2}" = '--uninstall' ]; then
|
||||
# Uninstall
|
||||
echo "Uninstalling..."
|
||||
waUninstallUser
|
||||
exit
|
||||
elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then
|
||||
echo "Setting up All Officially Supported Apps "
|
||||
echo "Removing any old configurations..."
|
||||
waUninstallUser
|
||||
waUninstallSystem
|
||||
waInstall
|
||||
waFindInstalled
|
||||
waConfigureWindows
|
||||
waConfigureAppsAllOfficiallySupported
|
||||
exit
|
||||
else
|
||||
usage
|
||||
fi
|
||||
fi
|
||||
elif [ "${INSTALL_TYPE}" = 'System' ]; then
|
||||
SUDO="sudo"
|
||||
sudo ls > /dev/null
|
||||
sudo ls >/dev/null
|
||||
BIN_PATH="/usr/local/bin"
|
||||
APP_PATH="/usr/share/applications"
|
||||
SYS_PATH="/usr/local/share/winapps"
|
||||
@ -309,6 +352,18 @@ elif [ "${INSTALL_TYPE}" = 'System' ]; then
|
||||
echo "Uninstalling..."
|
||||
waUninstallSystem
|
||||
exit
|
||||
elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then
|
||||
echo "Setting up All Officially Supported Apps "
|
||||
echo "Removing any old configurations..."
|
||||
waUninstallUser
|
||||
waUninstallSystem
|
||||
|
||||
echo "Installing..."
|
||||
waInstall
|
||||
waFindInstalled
|
||||
waConfigureWindows
|
||||
waConfigureAppsAllOfficiallySupported
|
||||
exit
|
||||
else
|
||||
usage
|
||||
fi
|
||||
@ -334,4 +389,4 @@ waConfigureWindows
|
||||
waConfigureApps
|
||||
waConfigureDetectedApps
|
||||
|
||||
echo "Installation complete."
|
||||
echo "Installation complete."
|
||||
|
Loading…
x
Reference in New Issue
Block a user