Skip to content

Commit

Permalink
Merge pull request #13 from JavaCardSpot-dev/development
Browse files Browse the repository at this point in the history
Final touches
  • Loading branch information
Aiosa authored Apr 10, 2020
2 parents c0b8884 + 47414b3 commit dc35715
Show file tree
Hide file tree
Showing 24 changed files with 135 additions and 646 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ How to get the store
In Releases, download the latest windows zip file. Extract contents of the zip and open it. Inside, double click
JCAppStore-[version]-win.jar file - it is an installer that will install the store for you: follow the instructions.

You should be able to run the installer by double-clicking; if it asks for the software to run the .jar with, select JRE
from `C:\Program Files\Java\jre_[version]\bin\java.exe`.

#### Unix/Linux
For ubuntu/debian, a `.deb` package is available. Just install the package and run the application twice: for the first time using `root`:
```
Expand All @@ -46,6 +49,10 @@ All you need to do is execute the shell script.
###### Apple OS-x
Apple is also a UNIX system. Use the guide above.

Advanced:
We are going to introduce Apple-specific .tar distribution (some GUI features), but now we are unable to build it because
we have no access to a mac computer. You can build yours version: in the `AppletStore` class, uncomment the applet-specific
lines and build the application.


How the store works?
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ izPackCreateInstaller.dependsOn jar
///////////////////////////

task unix(type: Exec) {
//note if this task fails for you, just run the script manually (from the folder the script is in)
group 'installation'
executable "$projectDir/installer-unix/installer.sh"
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
println "Unable to run on Windows."
return 1
}
commandLine '$projectDir/installer-unix/targenerator.sh'
}

unix.dependsOn jar
Expand Down
11 changes: 8 additions & 3 deletions installer-unix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ Files used to create unix tar ball and packages.

##### launcher.sh
File that can load JCAppStore's public key to your GPG keyring (for the first time the JCAppStore runs) and run the application.
##### installer.sh
##### targenerator.sh
Script that creates a tar ball.
##### JCAppStore.spec
To-Be RPM package spec file.
##### store.asc
Our public key.

#### deb folder
Contains files used to geterate `.deb` package.
- jcapp: shell script placed in `/usr/bin` to start the JCAppStore with. Same as `launcher.sh`, but also modifies the access rights
for jcappstore files (these are given to root from `dpkg`)
#### rpm folder
To-be rpm packaging.
63 changes: 63 additions & 0 deletions installer-unix/deb/jcapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
VERSION=1.0
DIR='/usr/share/java/jcappstore/'

if ! cat ${DIR}/jcappstore-do-not-ask.info ; then

#'sudo chown -R' stuff must have root
if [[ $EUID -ne 0 ]]; then
echo "You must run JCAppStore as a superuser for the first time."
exit 2;
fi

#check GPG presence
if ! gpg --help > /dev/null 2&>1 ; then
echo "You don't have GnuPG installed, the store will be unable to verify software integrity.\
this can be fixed anytime by GnuPG installation and JCAppStore key import."
echo "Next time, the application will start WITHOUT THIS NOTICE!"
#import GPG key if possible
else
if ! gpg --list-keys 3D6FE2832EDFE9C9 > /dev/null 2&>1 ; then
echo "JCAppStore automatically verifies the software integrity for you. In order to do that" \
"we need to import our public key to your keyring and set the ultimate trust."
echo "You don't have to import the key, then the verification will not work. This can be" \
"changed anytime."
echo "Do you wish to import y/n?"
read ANSWER
while [ "$ANSWER" != "y" ] && [ "$ANSWER" != "n" ] ; do
echo "Wrong answer. Try again:"
read ANSWER
done
if [[ "$ANSWER" == "y" ]] ; then
gpg --import ${DIR}/store.asc
(echo 5 && echo y)|gpg --command-fd 0 --expert --edit-key 3D6FE2832EDFE9C9 trust
echo "The key has been imported."
else
echo "The key can be imported anytime. Next time, the application will start WITHOUT THIS NOTICE!"
fi
fi
fi


#change owner to current user for jcappstore
if sudo chown ${SUDO_USER}: /usr/bin/jcapp ; then
echo "Setting shell executable rights to ${SUDO_USER}."
else
echo "Failed to set current user's ownership for /usr/bin/jcapp" \
": Either do this manually or use \"sudo jcapp\" to run the store each time."
echo "Use \"sudo chown -R [your user name]: /usr/bin/jcapp\""
fi
if sudo chown -R ${SUDO_USER}: /usr/share/java/jcappstore ; then
echo "Setting access rights to ${SUDO_USER}."
echo "The store has been succesfully set. Run jcapp again, now without super user."
touch ${DIR}jcappstore-do-not-ask.info
exit 0;
else
echo "Failed to set current user's ownership for /usr/share/java/jcappstore" \
": Either do this manually or use \"sudo jcapp\" to run the store each time."
echo "Use \"sudo chown -R [your user name]: /usr/share/java/jcappstore\""
fi
touch ${DIR}jcappstore-do-not-ask.info
fi
cd $DIR
java -jar ./JCAppStore-${VERSION}.jar
49 changes: 25 additions & 24 deletions installer-unix/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@ VERSION=1.0
DIR=./

if ! cat jcappstore-do-not-ask.info ; then
if ! gpg --version > /dev/null 2&>1 ; then
echo "You don't have GnuPG installed, the store will be unable to verify software integrity.\
if ! gpg --version > /dev/null 2&>1 ; then
echo "You don't have GnuPG installed, the store will be unable to verify software integrity.\
this can be fixed anytime by GnuPG installation and JCAppStore key import."
echo "Next time, the application will start WITHOUT THIS NOTICE!"
else
if ! gpg --list-keys 7B9FE0F5 > /dev/null 2&>1 ; then
echo "JCAppStore automatically verifies the software integrity for you. In order to do that" \
echo "Next time, the application will start WITHOUT THIS NOTICE!"
else
if ! gpg --list-keys 3D6FE2832EDFE9C9 > /dev/null 2&>1 ; then
echo "JCAppStore automatically verifies the software integrity for you. In order to do that" \
"we need to import our public key to your keyring and set the ultimate trust."
echo "You don't have to import the key, then the verification will not work. This can be" \
echo "You don't have to import the key, then the verification will not work. This can be" \
"changed anytime."
echo "Do you wish to import y/n?"
read ANSWER
while [ "$ANSWER" != "y" ] && [ "$ANSWER" != "n" ] ; do
echo "Wrong answer. Try again:"
read ANSWER
done
if [[ "$ANSWER" == "y" ]] ; then
gpg --import ${DIRECTORY}/store.asc
(echo 5 && echo y)|gpg --command-fd 0 --expert --edit-key 7B9FE0F5 trust
echo "The key has been imported."
else
echo "The key can be imported anytime. Next time, the application will start WITHOUT THIS NOTICE!"
fi
fi
fi
touch jcappstore-do-not-ask.info
echo "Do you wish to import y/n?"
read ANSWER
while [ "$ANSWER" != "y" ] && [ "$ANSWER" != "n" ] ; do
echo "Wrong answer. Try again:"
read ANSWER
done
if [[ "$ANSWER" == "y" ]] ; then
gpg --import ${DIRECTORY}/store.asc
(echo 5 && echo y)|gpg --command-fd 0 --expert --edit-key 3D6FE2832EDFE9C9 trust
echo "The key has been imported."
else
echo "The key can be imported anytime. Next time, the application will start WITHOUT THIS NOTICE!"
fi
fi
fi
touch jcappstore-do-not-ask.info
fi
java -jar ${DIR}/JCAppStore-${VERSION}.jar
cd ${DIR}
java -jar ./JCAppStore-${VERSION}.jar
File renamed without changes.
Binary file modified installer-unix/store.asc
Binary file not shown.
File renamed without changes.
2 changes: 2 additions & 0 deletions installer-win/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

Xml files used by IzPack to create an installation wizard. Unlike with UNIX, the key import is done when installing the store.
`dependency/` folder contains our public key, store icon, script for the key import and wizard xml files.


Binary file modified installer-win/dependency/jcappstore.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion installer-win/dependency/keyring.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ echo "Include public key into GnuPG key ring"

gpg --import ./scripts/store.asc

(echo 5 && echo y)|gpg --command-fd 0 --expert --edit-key 7B9FE0F5 trust
(echo 5 && echo y)|gpg --command-fd 0 --expert --edit-key 3D6FE2832EDFE9C9 trust

echo "Done!"
Binary file modified installer-win/dependency/store.asc
Binary file not shown.
2 changes: 1 addition & 1 deletion installer-win/installer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<info>
<appname>JCAppStore</appname>
<appversion>1.0</appversion>
<appsubpath>JCAppStore-1.0</appsubpath>
<appsubpath>JCAppStore</appsubpath>
<javaversion>1.8</javaversion>
<authors>
<author name="Jiří Horák" email="[email protected]"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public HelpWindow(String title, Container component) {
setModal(true);
component.setBackground(Color.WHITE);
setPreferredSize(new Dimension(850, 550));

setContentPane(new JScrollPane(component));
pack();
setLocationRelativeTo(null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void setup() {
bg = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
logger.warn("Could not open backround image file " + bg, e);
logger.warn("Could not open background image file " + bg, e);
loadDefault();
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/cz/muni/crocs/appletstore/util/LogOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,44 +63,34 @@ public LogOutputStream (Logger logger, Level level) {

/**
* Sets the logger where to log the bytes.
*
* @param logger the logger
*/
public void setLogger (Logger logger) {
this.logger = logger;
}

/**
* Returns the logger.
*
* @return DOCUMENT ME!
*/
public Logger getLogger () {
return logger;
}

/**
* Sets the logging level.
*
* @param level DOCUMENT ME!
*/
public void setLevel (Level level) {
this.level = level;
}

/**
* Returns the logging level.
*
* @return DOCUMENT ME!
*/
public Level getLevel () {
return level;
}

/**
* Writes a byte to the output stream. This method flushes automatically at the end of a line.
*
* @param b DOCUMENT ME!
*/
public void write (int b) {
byte[] bytes = new byte[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setDefaults() {
addIfMissing(Options.KEY_EXCLUSIVE_CARD_CONNECT, "false");
addIfMissing(Options.KEY_WARN_FORCE_INSTALL, "true");
addIfMissing(Options.KEY_LAST_SELECTION_LOCATION, Config.APP_LOCAL_DIR.getAbsolutePath());
addIfMissing(Options.KEY_STORE_FINGERPRINT, "4EB13B314E3FB0D05075897EFFACBB3D7B9FE0F5");
addIfMissing(Options.KEY_STORE_FINGERPRINT, "AE14854BECCAC4CC0BC695E83D6FE2832EDFE9C9");
}

@Override
Expand Down
Loading

0 comments on commit dc35715

Please sign in to comment.